我正在与盖茨比建立一个博客网站,我使用Netlify CMS来管理我的内容。每个博客文章都有一个在正面指定的特征图像。
但是,我有一些问题,让这些图像显示。我一直在犯这个错误:
GraphQL Error Field "image" must not have a selection since type "String" has no subfields.
我尝试添加gatsby-remark-relative-images来尝试修复这个问题,但是这不起作用--我仍然得到了相同的错误。
有什么办法解决这个问题吗?
目录结构
content
- article
我正在尝试向gatsby-starter-hero-blog添加新模板,但对新模板的GraphQL查询被拒绝: warning The GraphQL query in the non-page component
"/Users/mc/workspaces/mc/src/templates/NoteBookTemplate.js" will not be run.
Queries are only executed for Page or Layout components. Instead of a query,
co-locate a GraphQL fragment
我想通过GraphiQl从网页上的一个特定文件夹中查询多个图像。
我尝试过多种方法,但我无法显示图像。不过,我可以获得一个图像显示(没有映射),但不是多个。
我还可以在网页上显示图像的id或底部,以显示所有这些内容的列表。但是,如果我尝试使用实际的图像,就会在控制台中得到以下错误消息:
Warning: Failed prop type: The prop `alt` is marked as required in `J`, but its value is `undefined`.
at J (webpack-internal:///./node_modules/gatsby-pl
我试图在Gatsby站点上使用GraphQL片段,我试图按照指南创建这个片段,但是Gatsby抛出一个错误,声明我的片段不存在
The fragment "PageFragment" does not exist.
我将我的片段定位在一个名为“graphql-片段”的文件夹中,该文件夹位于Gatsby项目的根目录中,该文件夹包含一个名为" pageFragment.js“的文件,即我的片段pageFragment.js。
import { graphql } from "gatsby";
export const PageFragment = grap
我希望通过JsonApi从Drupal站点获取数据到Gatsby。
我希望呈现特定的内容类型与所有细节和信息。
我可以用JsonApi从drupal获取文章标题,但现在我希望在另一个页面上呈现该文章的图像和信息(内容类型)。所以我使用了盖茨比的createPage方法,但是我得到了以下错误:
**ERROR path is not defined ReferenceError: path is not defined - gatsby-node.js:28**
参考链路
我的档案结构
gatsby-node.js
exports.createPages = async ({ gra
我试图在Gatsby的索引页面上显示我所有满意的博客帖子,但是我得到了一个错误。 我正在gatsby-node.js上创建帖子页面,如下所示: const path = require(`path`)
// Log out information after a build is done
exports.onPostBuild = ({ reporter }) => {
reporter.info(`Your Gatsby site has been built!`)
}
// Create blog pages dynamically
exports.createPages =