【问题标题】:Strapi isn't showing both Content Types on GraphQLStrapi 没有在 GraphQL 上显示两种内容类型
【发布时间】:2020-11-09 14:42:26
【问题描述】:

背景:我正在使用 Strapi+Gatsby 构建一个基本博客,关注 this tutorial

问题:我创建了内容类型 'Category''Post'(在本教程中称为 'Article'), 'Post' 有一个关系字段来关联这两种内容类型('Category' 有许多 'Posts')。当尝试通过 graphQL (localhost:xxxx/___graphql) 访问这些内容类型时,我看不到 'Categories',我只看到 'Posts' em>。

我想以与查询 'Post' 相同的方式查询 'Category'

而且我注意到 'Post' 有一个名为 'Category' 的组件,因为关系字段。

知道为什么 'Category' 没有显示吗?

【问题讨论】:

    标签: reactjs graphql gatsby content-type strapi


    【解决方案1】:

    要显示两种内容类型,它们都必须在插件配置中指定[新手错误,抱歉问题]:

    resolve: "gatsby-source-strapi",
    options: {     
        apiUrl: process.env.API_URL,
        contentTypes: ["category", "article"],
        queryLimit: 1000,
    }
    

    【讨论】:

      猜你喜欢
      • 2020-12-03
      • 2022-11-12
      • 2019-06-27
      • 2021-05-16
      • 1970-01-01
      • 1970-01-01
      • 2019-11-02
      • 1970-01-01
      • 2011-01-23
      相关资源
      最近更新 更多