php - WordPress 盖茨比
问题描述
我正在将 Gatsby 与 Wordpress 一起使用。我根据文档设置了所有内容。
但是当我去 Graphql 查询资源管理器(可以生成 graphql 查询)时,没有与 Wordpress 相关的查询。错误是:
无法在查询类型上查询字段 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`,
],
}
解决方案
推荐阅读
- c# - 调试时 blazor 服务器超时
- javascript - 使用Javascript返回给定数字/步长的数字范围
- node.js - 不能以任何方式要求@tensorflowjs/tfjs-node
- linux - 在等待 candump 命令接收数据时回显字符串
- javafx - 我们如何从 ListView 中进行多选?我看到它可以在桌面上运行,但不能在手机上运行
- node.js - 如何从nodejs获取当前的操作系统名称服务器?
- angular - 如何使用 Angular Material Table 值的条件格式
- python - 如何从 HTML 输入元素中检索“值”?
- javascript - 导入一个 js 库并在 vue-cli 组件中全局使用它(vue 2)
- google-cloud-platform - 云代码:部署到云运行不起作用