如何在Gatsby中添加Facebook评论插件? [英] How to add facebook comment plugin in Gatsby?

查看:77
本文介绍了如何在Gatsby中添加Facebook评论插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Gatsby创建一个博客网站.我对Gatsby/React非常陌生.我需要有关Gatsby的Facebook评论插件的一些文档.

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.

谢谢.

推荐答案

如果您的意思是使用Facebook的Graph API检索Facebook注释,该API提供

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

然后,通过将其添加到gatsby-config.js来配置源插件:

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.
      },
    },
  ],

当执行gatsby develop并导航到预配置的本地环境(例如http://localhost:8000)时,您应该能够使用http://localhost:8000/___graphql上的GraphiQL探索GraphQL模式.

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.

这篇关于如何在Gatsby中添加Facebook评论插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆