npm i gatsby-plugin-yoast-sitemap
If you have content editors/SEO people that work heavily with Yoast on WP, down to the sitemap level, then this plugin will save you from having to re-write Yoast's sitemap logic, which isn't similarly implemented by any other Gatsby sitemap plugins. This means any Geo or News style sitemap data that Yoast adds will be accessible via your Gatsby site - which is precisely the use case this was built for.
After installing, add the plugin to your gatsby-config.js
file. You will need to add config options to setup the plugin.
Option Name | Description |
---|---|
baseUrl (required) | The URL of your Wordpress Instance. Do not append the /graphql, if you're using gatsby-source-wordpress, etc. |
gatsbyUrl (required) | The URL where your site will live. This will be used to swap out links in your sitemap. |
auth (optional) | If your Wordpress Instance is protected by Basic Auth, you can add your { username, password } here. Same syntax as gatsby-source-wordpress. |
publicPath (optional) | This is the folder your re-parsed sitemap will be added to. Default is ./public , just like Gatsby. |