gatsby-plugin-advanced-sitemap icon indicating copy to clipboard operation
gatsby-plugin-advanced-sitemap copied to clipboard

Error querying gatsby-source-graphql plugin

Open moritzsalla opened this issue 4 years ago • 2 comments

I am using gatsby-source-graphql to query GraphCMS, which nests my data collections under the parent field graphCMS.

{
  graphCMS {
    projects(stage: PUBLISHED) {
      slug
      updatedAt
      publishedAt
    }
    workshops(stage: PUBLISHED) {
      slug
      updatedAt
      publishedAt
    }
  }
}

With no configuration, gatsby-plugin-advanced-sitemap creates a single sitemap-pages.xml that gives me a 404.

I also can't figure out how to map nested data sources, since there's no way to destructure (or perhaps there is?). Nesting objects won't work.

{
  mapping: {
    graphCMS: {
      projects: {
        sitemap: 'projects',
      },
      workshops: {
        sitemap: 'workshops',
      },
    },
  },
}

moritzsalla avatar Feb 03 '21 22:02 moritzsalla

Anyway to reproduce this? Seems like a wrong query request. As this plugin expects a node or edges.

yogeshkotadiya avatar Feb 10 '21 17:02 yogeshkotadiya

It's a little hard to replicate, unfortunately.

As this plugin expects a node or edges.

…seems to be the issue. I'm fairly new to graphql so I've got to wrap my head around this.

Is there a way around this? Can't the plugin take nodes 2 levels deep? Perhaps it's possible to configure gatsby-source-graphql to expose projects and workshops top-level without nesting them under the graphCMSedge.

moritzsalla avatar Feb 12 '21 17:02 moritzsalla