How to add facebook comment plugin in Gatsby?

*爱你&永不变心* 提交于 2020-01-23 17:47:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!