【发布时间】:2020-10-16 17:41:53
【问题描述】:
我将 Gatsby 与 Wordpress 一起使用。我根据文档设置了所有内容。
但是当我转到 Graphql 查询资源管理器(可以生成 graphql 查询)时,没有与 Wordpress 相关的查询。错误是:
无法查询类型 Query 上的 allWordpressPost 字段。
我也安装了“gatsby-source-wordpress”模块。
这是我的 global.config.js 代码:
module.exports = { siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`, },
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-wordpress`,
options: {
// Specify the URL of the WordPress source
baseUrl: `example.com`,
protocol: `https`,
// Indicates if a site is hosted on WordPress.com
hostingWPCOM: false,
// Specify which URL structures to fetch
includedRoutes: [
'**/posts',
'**/tags',
'**/categories'
]
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
}
【问题讨论】:
标签: php wordpress graphql gatsby