An XML sitemap is a file that lists the URLs you want search engines to know about. It is not required to rank, but it accelerates discovery of new and updated pages, especially on large or heavily interlinked sites.
What to include
- Canonical URLs only — never include a URL that redirects or is a duplicate
- Pages you want indexed — not cart, checkout, thank-you or admin pages
- A realistic
lastmodthat changes when the page actually changes - Optionally
changefreqandpriority— Google ignores them, other engines may not
The size limits
- Up to 50,000 URLs and 50MB uncompressed per file
- Beyond that, use a sitemap index that references multiple sitemap files
A minimal sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-10-07</lastmod>
</url>
<url>
<loc>https://example.com/pricing</loc>
<lastmod>2026-10-07</lastmod>
</url>
</urlset>Sitemap index (multiple files)
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://example.com/sitemap-posts.xml</loc></sitemap>
<sitemap><loc>https://example.com/sitemap-products.xml</loc></sitemap>
</sitemapindex>How to submit
Reference the sitemap from robots.txt and submit the URL in Google Search Console and Bing Webmaster Tools. Most frameworks can generate a sitemap automatically — for example Next.js, WordPress and Shopify.
Read the reports correctly
- Discovered = Google read the sitemap and knows the URLs exist
- Indexed = Google chose to include them
A big gap between the two is normal for new sites and thin pages, and shrinks over time as quality signals build.
Common mistakes
- Listing non-canonical or 404 URLs
- Never updating
lastmod - Including thousands of low-value parameter URLs
- Assuming a sitemap fixes an indexing problem — it does not override
noindex,robots.txtblocks, or thin content - Submitting the same URL set twice under different names
Worked example
A blog with 300 posts and 40 pages that wants clean discovery:
1. Generate sitemap-posts.xml (300 canonical posts) and sitemap-pages.xml (40 pages).
2. Create sitemap.xml as a sitemap index referencing both.
3. Add Sitemap: https://example.com/sitemap.xml to robots.txt.
4. Submit once in GSC; resubmit only after major URL changes.
Generate one
Paste your URLs into the free sitemap generator and copy a valid XML file, or use the API to build sitemaps in bulk.