在 GraphiQL 中,我试图从 Contentful 博客文章中查询 heroImage 字段,该文章默认存在于我的博客文章内容类型中:
原始查询代码:
{
allContentfulBlogPost {
edges {
node {
id
title
slug
body {
childMarkdownRemark {
excerpt
}
}
heroImage {
gatsbyImageData(
layout: CONSTRAINED
placeholder:BLURRED
width: 300
)
}
}
}
}
}
但我收到错误消息:“无法查询类型为“ContentfulBlogPost”的字段“heroImage”。,
事实上,heroImage 字段甚至没有出现在我的 GraphiQL 资源管理器中(见下图),我不明白为什么。这个领域确实存在,我什至确保每篇博文都有与之相关的英雄形象。
任何帮助将不胜感激,因为我对这个很困惑。
我遇到了同样的问题。我运行命令 'npm install gatsby-transformer-remark' 并重新运行 gatsby develop。现在 heroImage 出现了
我遇到了同样的问题。运行 gatsby clean 对我有用