Lesson

Generate an SEO-friendly sitemap for your Gatsby site

Sitemaps are an important tool that search engine crawlers use to index your website. By generating a sitemap.xml file, we improve our chances of showing up early in the search results!

Duration
6 min
Access
Free
Transcript
Available

Sitemaps are an important tool that search engine crawlers use to index your website. By generating a sitemap.xml file, we improve our chances of showing up early in the search results!

We'll use gatsby-plugin-sitemap to do the heavy lifting for us, and see how we can use its configuration options to do light tweaks (exclude certain pages based on glob-matching) as well as more involved ones (using GraphQL context to pull in data from our data model, and use that information when generating the sitemap).

Once your sitemap is generated, you can submit it to Google through the Google Search Console, or by adding it to robots.txt. More info: https://support.google.com/webmasters/answer/183668?hl=en