XML Sitemaps
Help search engines find your pages with an XML sitemap.
An XML sitemap lists the URLs you want search engines to crawl, along with optional metadata like last-modified dates. It is especially useful for large or new sites.
Best practices
- Include only canonical, indexable URLs (status 200).
- Exclude noindex, redirected or blocked URLs.
- Keep each sitemap under 50,000 URLs / 50 MB; split with a sitemap index if larger.
- Submit it in Google Search Console and list it in robots.txt.
Example
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/coffee/pour-over-guide</loc>
<lastmod>2026-07-01</lastmod>
</url>
<url>
<loc>https://example.com/coffee/best-gooseneck-kettle</loc>
<lastmod>2026-06-18</lastmod>
</url>
</urlset>When to use it
- A news publisher generates an XML News Sitemap so Google discovers and indexes breaking stories within minutes of publication.
- An e-commerce site with 80 000 products splits its sitemap into multiple files of 50 000 URLs each and registers a sitemap index with Search Console.
- A content team adds <lastmod> timestamps to their sitemap so Googlebot prioritises re-crawling recently updated pages over stale ones.
More examples
Standard XML sitemap structure
A well-formed sitemap with lastmod and priority attributes helps Googlebot understand recency and importance when scheduling crawls.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2024-06-01</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/blog/seo-guide/</loc>
<lastmod>2024-05-15</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>Sitemap index for large sites
A sitemap index file groups multiple child sitemaps, keeping each file under the 50 000-URL limit and making large-site management scalable.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-products-1.xml</loc>
<lastmod>2024-06-01</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-products-2.xml</loc>
<lastmod>2024-06-01</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-blog.xml</loc>
<lastmod>2024-05-28</lastmod>
</sitemap>
</sitemapindex>Submit sitemap via Search Console API
Submitting the sitemap via API ensures Google is immediately aware of the file and can begin scheduling crawls of listed URLs.
# Submit a sitemap to Google Search Console
curl -X PUT \
'https://searchconsole.googleapis.com/webmasters/v3/sites/https%3A%2F%2Fexample.com/sitemaps/https%3A%2F%2Fexample.com%2Fsitemap.xml' \
-H 'Authorization: Bearer YOUR_TOKEN'
# Check submission status
curl -s \
'https://searchconsole.googleapis.com/webmasters/v3/sites/https%3A%2F%2Fexample.com/sitemaps' \
-H 'Authorization: Bearer YOUR_TOKEN' | python3 -m json.tool
Discussion