Monitory
← All guides

Guides

How to build and monitor an XML sitemap

What a healthy sitemap looks like, how to generate it, how to fix broken or duplicate URLs and how to keep it valid.

What a sitemap does

An XML sitemap lists the pages you want search engines to find. It does not guarantee indexing, but it helps new pages get discovered faster, especially on large sites or sites with few inbound links.

What a good sitemap looks like

  • It loads at /sitemap.xml and is valid XML.
  • Each entry has a valid <loc>, and a valid priority and changefreq if you set them.
  • No URL appears twice, and no single sitemap lists more than 50,000 URLs. Use a sitemap index above that.
  • Every listed URL works. A sitemap with broken or duplicate URLs wastes search engines' crawl budget and slows the indexing of your new pages.

Build it

Generate the sitemap with your CMS or framework instead of writing it by hand, so it updates with your content. Reference it in robots.txt with a Sitemap: line and submit it in Google Search Console.

Fix common problems

  • The sitemap returns 404. Generate one, or set the right sitemap URL on the monitor.
  • Broken URLs are listed. Remove deleted pages from the sitemap or redirect them. Most generators rebuild the sitemap automatically.
  • Pages you do not want indexed are listed. Take them out, and make sure they are not blocked by robots.txt either, since the two signals conflict.

Keep it healthy

The sitemap check reads your sitemap once a day, follows sitemap indexes and requests up to 5,000 listed URLs. It fails on an error status, invalid entries, duplicates or broken URLs, and warns when some URLs could not be checked because your site rate-limited it.

Keep reading