如何修复Gatsby查询内容引用类型的查询

时间:2019-01-22 15:58:40

标签: graphql gatsby contentful

我从内容丰富获取内容。 结构很简单:

页面

- sections (ref)
-- Section1
--- modules (ref)
---- Module1
---- Module2
-- Section2
--- modules (ref)
---- Module1
---- Module2

我似乎无法达到嵌套引用类型。

我的内容模型有一个页面,该页面包含一个参考模块模块,这些模块包括标题和其他模块列表。似乎插件无法访问内容。你知道为什么吗?以及如何解决?

    allContentfulProductLandingPage{
        edges {
            node {
                name
                    sections { #this is a reference type
                        title
                        modules { #this is a reference type
                            __typename
                            #title #I need title and subfields here
                        }
                    }
                }
            }
        }
    }
}```



How can I get more then the __typename from this query? Likethe title I commented out?


1 个答案:

答案 0 :(得分:0)

您可能已经知道了这一点,我遇到了同样的问题。我可以使它起作用的唯一方法是,如果所有引用都来自相同的内容类型。我无法混合搭配它们。

相关问题