← All guides
XML Sitemap Guide
An XML sitemap is a roadmap for search engines. It lists the URLs you want indexed and provides signals about their importance and freshness.
7 min readUpdated March 2026
1. What is an XML sitemap?
An XML sitemap is a file that lists the URLs on your website that you want search engines to crawl and index. It helps search engines discover pages that might be hard to find through internal linking alone.
- Especially useful for new sites, large sites, or sites with deep content
- Helps search engines discover pages faster
- Provides metadata: last modification date, change frequency, priority
- Not a guarantee of indexing — it is a hint, not a directive
2. Sitemap format & syntax
XML
<?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-03-15</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/about</loc>
<lastmod>2026-01-10</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>- loc: The full URL (required, must be absolute)
- lastmod: Last modification date in W3C format (optional but recommended)
- changefreq: How often the page changes (optional, mostly ignored by Google)
- priority: Relative priority 0.0-1.0 (optional, mostly ignored by Google)
Google officially ignores
changefreq and priority. Focus on accurate lastmod dates instead.3. Sitemap index files
A single sitemap can contain up to 50,000 URLs and must be under 50MB (uncompressed). For larger sites, use a sitemap index file.
XML
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-pages.xml</loc>
<lastmod>2026-03-15</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-blog.xml</loc>
<lastmod>2026-03-20</lastmod>
</sitemap>
</sitemapindex>Split sitemaps by content type (pages, blog posts, products) to make it easier to monitor indexing per section in Search Console.
Dr Urls validates your sitemap structure and checks every URL for errors. Try free.
Check your site4. What to include (and exclude)
Include
- All pages you want indexed
- Canonical URLs only (not duplicates or parameterized versions)
- Pages that return 200 status codes
Exclude
- Pages with
noindextags - Redirect URLs (3xx)
- Error pages (4xx, 5xx)
- Non-canonical URLs
- Login-required or gated pages
- URL parameter variations
Including noindex URLs in your sitemap sends conflicting signals. Google will get confused and may ignore your noindex directive.
5. Using lastmod correctly
The lastmod tag is the most useful signal in your sitemap, but only if it is accurate.
- Only update lastmod when the page content meaningfully changes
- Do not set all pages to today's date — Google will learn to ignore your lastmod values
- Use the actual content modification date from your CMS or database
- Format:
YYYY-MM-DDor full W3C datetime
6. Submitting your sitemap
- Add a Sitemap directive to your robots.txt
- Submit via Google Search Console (Sitemaps section)
- Submit via Bing Webmaster Tools
- Ping Google:
https://www.google.com/ping?sitemap=URL
7. Common mistakes
- Stale sitemaps that never get updated
- Including URLs that return 404 or redirect
- Using relative URLs instead of absolute
- Exceeding the 50,000 URL or 50MB limit
- Not gzipping large sitemaps (use
sitemap.xml.gz) - Mismatched protocols (HTTP sitemap on HTTPS site)
Related guides
Check your website now — free
Run a comprehensive audit across SEO, security, performance, and accessibility. No sign-up required.
Check your website