问题
I'm creating a blog site using Gatsby. I am very very new to Gatsby/React. I need some documentation about the facebook comment plugin for Gatsby.
Thanks in advance.
回答1:
If you mean retrieving Facebook comments using Facebook's Graph API, which provides comments, you may be able to achieve that with gatsby-source-facebook, which you can install as follows into your Gatsby site:
npm install --save gatsby-source-facebook
Then, configure the source plugin by adding this to gatsby-config.js
:
plugins: [
{
resolve: `gatsby-source-facebook`,
options: {
places: [`${facebookPageID}`], // Can be either a numeric ID or the URL ID
params: {
fields: 'hours, posts { message, created_time }', // See Facebooks API to see what you can query for
},
key: process.env.FACEBOOK_GRAPH_TOKEN, // You will need to create a Facebook application and go through review in order to get an API token.
},
},
],
When you execute gatsby develop
and navigate to the provisioned local environment, such as http://localhost:8000
, you should be able to explore your GraphQL schema using GraphiQL at http://localhost:8000/___graphql
.
来源:https://stackoverflow.com/questions/55554574/how-to-add-facebook-comment-plugin-in-gatsby