我正在使用Gatsby创建一个博客站点。我对Gatsby / React非常新。我需要一些关于Gatsby的facebook评论插件的文档。
提前致谢。
如果您的意思是使用提供comments的Facebook的Graph API检索Facebook评论,您可以使用gatsby-source-facebook
实现这一点,您可以将以下内容安装到您的Gatsby网站:
npm install --save gatsby-source-facebook
然后,通过将此插件添加到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模式。