Gatsby: Issues with Sitemap plugin integration

Created on 10 Oct 2017  ·  6Comments  ·  Source: gatsbyjs/gatsby

A few issues are coming together to make for a difficult time integrating the sitemap plugin:

  1. The sitemap docs indicate that the default query filters for MarkdownRemark pages only, but this doesn't seem to be the case anymore (if I'm reading #1271 and https://github.com/gatsbyjs/gatsby/pull/1351 correctly.)

  2. https://sitemap.gatsbyjs.org seems to be down (found here)

  3. With the default configuration, I'm seeing an error in gatsby build:

error Plugin gatsby-plugin-sitemap returned an error


  Error: GraphQLError: Cannot query field "siteUrl" on type "siteMetadata_2".

  - internals.js:21
    [www.myvisor.com]/[gatsby-plugin-sitemap]/internals.js:21:13
  1. The sitemap plugin doesn't seem to work in development mode, which makes for a slow debugging experience.

Thanks!

Most helpful comment

@rzubrycki 🙌 Figured it out, sitemap gets hangry when it tries to query a sitemap url when there isn't one provided. All you gotta do is modify the gatsby-config.js file and fill in the required options on siteMetadata.

siteMetadata: {
    title: `ExampleTitle`,
    description: `ExampleDescription`,
    author: `@exampleuser`,
    siteUrl: `example.com` or `localhost:XXXX`
  },

All 6 comments

So yeah this isn't super well documented. You probably should dig through the source to understand it better. Would love a PR adding more docs.

On the failing query. You'll want to copy the query into graphiql to tweak it to meet your needs. Something the docs should make clear is either you need to add the required info to your site metadata or change the query.

Thanks. This helps me understand the intent. I'll see if I can figure it out and send a PR.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues as many of them have already been resolved with the latest updates or explained in a previous issue.

Feel free to open a new one if you still experience this problem or a similar one! 👍

Hey, guys, need help with this error:

"error Plugin gatsby-plugin-sitemap returned an error

Error: Cannot query field "siteUrl" on type "siteMetadata_2". Did you mean "siteURL" or "start_url"?
GraphQL request (5:11)
4: siteMetadata {
5: siteUrl
^
6: }"

Hey, guys, need help with this error:

"error Plugin gatsby-plugin-sitemap returned an error

Error: Cannot query field "siteUrl" on type "siteMetadata_2". Did you mean "siteURL" or "start_url"?
GraphQL request (5:11)
4: siteMetadata {
5: siteUrl
^
6: }"

@rzubrycki I've got almost the exact same error just now on my build 🤷‍♂️
From my error message, it feels like there's an issue with one of my graphql queries or sitemap tacking on an extra field or getting lost somewhere? The gatsby site will run in development mode, but keeps failing here on build. Any ideas?

```error Plugin gatsby-plugin-sitemap returned an error

Error: Cannot query field "siteUrl" on type "SiteSiteMetadata".
GraphQL request (5:11)
4: siteMetadata {
5: siteUrl
^
6: }

  • internals.js:27
    [clc-wordpress-gatsby]/[gatsby-plugin-sitemap]/internals.js:27:13```

@rzubrycki 🙌 Figured it out, sitemap gets hangry when it tries to query a sitemap url when there isn't one provided. All you gotta do is modify the gatsby-config.js file and fill in the required options on siteMetadata.

siteMetadata: {
    title: `ExampleTitle`,
    description: `ExampleDescription`,
    author: `@exampleuser`,
    siteUrl: `example.com` or `localhost:XXXX`
  },
Was this page helpful?
0 / 5 - 0 ratings

Related issues

theduke picture theduke  ·  3Comments

ferMartz picture ferMartz  ·  3Comments

dustinhorton picture dustinhorton  ·  3Comments

Oppenheimer1 picture Oppenheimer1  ·  3Comments

andykais picture andykais  ·  3Comments