【发布时间】:2022-02-19 09:41:03
【问题描述】:
在 GraphiQL 中,我尝试从 Contentful 博客文章中查询 heroImage 字段,该字段默认存在于我的博客文章内容类型中:
原始查询代码:
{
allContentfulBlogPost {
edges {
node {
id
title
slug
body {
childMarkdownRemark {
excerpt
}
}
heroImage {
gatsbyImageData(
layout: CONSTRAINED
placeholder:BLURRED
width: 300
)
}
}
}
}
}
但我收到错误:“无法在类型“ContentfulBlogPost”上查询字段“heroImage”。”,
事实上,我的 GraphiQL 资源管理器中甚至没有显示 heroImage 字段(见下图),我不知道为什么。这个领域确实存在,我什至确保每篇博文都有一个与之相关的英雄形象。
任何帮助都将不胜感激,因为我对此感到很困惑。
【问题讨论】:
-
愚蠢的问题:你的
heroImage发布了吗?
标签: contentful