Learning about XML sitemaps
A sitemap is a special file that provides information about the web pages and files on your site, as well as their relationships. Creating this file allows web crawlers to gather information about your site without having to crawl your site manually. It helps us highlight to search engines which pages we specifically want them to look at. Let's create a sitemap for our site:
- Install the
gatsby-plugin-sitemap
dependency:npm install gatsby-plugin-sitemap
- Update your
gatsby-config.js
file:module.exports = { siteMetadata: { siteUrl: `https://your.website.com`, }, plugins: [ `gatsby-plugin-sitemap`, // other plugins ] }
By including this plugin, Gatsby will automatically create a sitemap when building the site. It's important to remember that this plugin only generates output when running in production. When you're using
gatsby develop
, you will not see your sitemap file being created. Only when thegatsby build
command...