问题:
我正在使用 Prismic 将数据发送到我的网站。
在 Prismic 中,我有一个 Type ( testimonial_list
),它由一组内容关系字段 (Prismic Type testimonials
) 组成。
要查询内部类型的数据,我需要通过 graphql 中的文档字段访问它们并使用内联片段。
我已按照此处的说明进行操作: https ://github.com/angeloashmore/gatsby-source-prismic#Query-Content-Relation-fields
在 graphql 中,我设法导航到testimonial
数据字段(在document
字段上),但该document
字段返回 null,这就是我卡住的地方。我无法弄清楚为什么它会在内容存在时返回 null 并且在 graphql 中清楚地找到了这些字段。
信息:
我的项目是使用 Gatsby 构建的,我正在使用插件gatsby-source-prismic
v3.1.1
在这里您可以看到我可以访问正确的字段数据,并且我得到了正确数量的节点返回但document
为空:
这是testimonial_list
Prismic 类型的 JSON:
{
"Main" : {
"prismic_title" : {
"type" : "StructuredText",
"config" : {
"single" : "heading6",
"label" : "Title (only used to name entry in Prismic list)",
"placeholder" : "Prismic list title (otherwise \"undefined\")"
}
},
"page" : {
"type" : "Select",
"config" : {
"options" : [ "Homepage", "Option 2", "Option 3" ],
"label" : "Website page to appear on:"
}
},
"testimonial_list" : {
"type" : "Group",
"config" : {
"fields" : {
"testimonial" : {
"type" : "Link",
"config" : {
"select" : "document",
"customtypes" : [ "testimonial" ],
"label" : "testimonial"
}
}
},
"label" : "Testimonial List"
}
}
}
}
感谢您的帮助,如果我可以提供更多信息来帮助推断问题,请告诉我。