XML sitemaps

An XML sitemap is a file that lists the URLs you want search engines to know about. It's a hint, not a command, but a well-built sitemap speeds up discovery and helps with large sites.

What a sitemap contains

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/page1</loc>
    <lastmod>2026-04-18</lastmod>
    <priority>0.8</priority>
  </url>
  ...
</urlset>

Required vs optional fields

What to include

What NOT to include

Including garbage URLs sends mixed signals and wastes crawl budget.

Size limits

Over these limits, split into multiple sitemaps + use a sitemap index file.

Sitemap index files

For large sites, create a sitemap index that lists child sitemaps:

<?xml version="1.0"?>
<sitemapindex xmlns="...">
  <sitemap><loc>https://example.com/sitemap-posts.xml</loc></sitemap>
  <sitemap><loc>https://example.com/sitemap-products.xml</loc></sitemap>
</sitemapindex>

Sitemap variants

How to submit

  1. Host at https://yourdomain.com/sitemap.xml (standard location)
  2. Reference in robots.txt: Sitemap: https://yourdomain.com/sitemap.xml
  3. Submit in Google Search Console → Sitemaps → add new
  4. Do the same in Bing Webmaster Tools

Dynamic sitemaps

On CMS-driven sites (WordPress, Shopify, etc.), the sitemap should update automatically when content changes. Most modern CMSes handle this via plugins (Yoast, RankMath) or built-in features.

Debugging sitemaps

When sitemaps don't help much

Small sites (<100 pages) with good internal linking don't strictly need a sitemap. Google will find everything anyway. But there's no cost to including one, so always do.