Skip to content

Commit

Permalink
[gatsby-plugin-sitemap] - update docs (#3234)
Browse files Browse the repository at this point in the history
* correct default query description (all pages are included, not just makdown)

* clarify how to override defaultOptions via gatsby-config.js

* add warning: sitemap is not generated when running `gatsby develop`
  • Loading branch information
busticated authored and KyleAMathews committed Dec 16, 2017
1 parent ca2cc8e commit 06b7a75
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions packages/gatsby-plugin-sitemap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,43 @@ plugins: [
]
```

Above is the minimal configuration required to have it work, however, note that
the
[default query](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-sitemap/src/internals.js)
only retrieves nodes of type `MarkdownRemark`. Any parameter in `defaultOptions`
can be overridden.
Above is the minimal configuration required to have it work. By default, the
generated sitemap will include all of your site's pages except the dev 404 page
(`/dev-404-page/`).

The [default query](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-sitemap/src/internals.js#L16)
as well as any of the other `defaultOptions` [here](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-sitemap/src/internals.js#L15)
can be overridden - for example:

```javascript
// In your gatsby-config.js
siteMetadata: {
siteUrl: `https://www.example.com`,
},
plugins: [
{
resolve: `gatsby-plugin-sitemap`
options: {
output: `/some-other-sitemap.xml`,
query: `
{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
edges {
node {
path
}
}
}
}`
}
}
]
```

_NOTE: This plugin only generates output when run in `production` mode! To test your sitemap, run: `gatsby build && gatsby serve`_

0 comments on commit 06b7a75

Please sign in to comment.