- Technical SEO
- SEO
- Getting Started
XML Sitemap Best Practices: What to Include, What to Exclude
A well-configured XML sitemap helps search engines find and crawl your important pages. Learn what to include, what to leave out, and common pitfalls.
An XML sitemap is a file that lists the pages you want search engines to crawl and index. It doesn’t guarantee indexing, but it ensures search engines know your important pages exist — especially pages that are hard to discover through internal links alone.
What Is an XML Sitemap?
An XML sitemap is a structured file (usually at /sitemap.xml) that lists URLs along with optional metadata like last modification date, change frequency, and priority.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/sitemaps/sitemap.xsd">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2026-05-01</lastmod>
</url>
<url>
<loc>https://www.example.com/blog/seo-guide</loc>
<lastmod>2026-04-15</lastmod>
</url>
</urlset>
Search engines use your sitemap as a discovery aid — a hint about which pages exist and which have been recently updated.
What to Include in Your Sitemap
Include
- All canonical pages you want indexed (your homepage, key landing pages, blog posts, product pages)
- Recently updated pages — the
<lastmod>tag helps search engines prioritize recrawling - Pages with few internal links — orphan pages that search engines might not find through crawling alone
- Localized versions — if you have hreflang pages, include all language variants
Exclude
- Pages with
noindex— if you’re telling search engines not to index a page, don’t list it in your sitemap - Redirected URLs — only include the final destination URL, not the redirect source
- Duplicate content — don’t include both
https://site.com/pageandhttps://site.com/page/unless both are canonical - Paginated pages — generally exclude
/page/2,/page/3etc. unless each page has unique content - Utility pages — search results pages, login pages, thank-you pages, and admin dashboards
- URLs blocked by robots.txt — if crawling is blocked, listing the URL in a sitemap sends mixed signals
Where Should Your Sitemap Live?
The standard location is:
https://www.yoursite.com/sitemap.xml
But your sitemap can live at any URL — as long as you tell search engines where to find it:
- Reference it in robots.txt (recommended):
Sitemap: https://www.yoursite.com/sitemap.xml
-
Submit it in Google Search Console under Sitemaps → Add a new sitemap
-
Submit it in Bing Webmaster Tools under Sitemaps
Your robots.txt should always reference your sitemap, even if you also submit it manually.
Sitemap Size Limits
A single sitemap file can contain:
- Maximum 50,000 URLs
- Maximum 50 MB uncompressed
If your site has more than 50,000 pages, use a sitemap index file that references multiple smaller sitemaps:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/sitemaps/sitemap.xsd">
<sitemap>
<loc>https://www.example.com/sitemap-pages.xml</loc>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap-blog.xml</loc>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap-products.xml</loc>
</sitemap>
</sitemapindex>
The lastmod Tag: Use It Correctly
The <lastmod> tag tells search engines when a page was last meaningfully updated. This is powerful — search engines use it to prioritize recrawling.
Rules:
- Only update
lastmodwhen the page’s content actually changes, not on every deploy - Use full ISO 8601 format:
2026-05-11T14:30:00+00:00or at minimum2026-05-11 - Don’t set all pages to today’s date — search engines will ignore
lastmodentirely if it’s clearly inaccurate
The priority and changefreq Tags: Skip Them
Google has publicly stated that it ignores the <priority> and <changefreq> tags. Bing has said similar things. These tags are relics from the original sitemap protocol and add no value today.
Don’t waste time configuring them. Focus on <loc> and <lastmod>.
Dynamic vs Static Sitemaps
Static Sitemaps
Generated once and updated manually or during deploys. Fine for small sites with infrequent content changes.
Dynamic Sitemaps
Generated on-the-fly by your CMS or application. Better for sites with frequent content updates (blogs, ecommerce, news sites).
Most frameworks have sitemap plugins:
- WordPress: Yoast SEO, Rank Math, or XML Sitemaps
- Astro:
@astrojs/sitemap - Next.js:
next-sitemap - Shopify: Built-in (auto-generated)
Common Sitemap Mistakes
- Not having a sitemap at all. Small sites can rank without one, but there’s no reason not to have one.
- Including noindex pages. Contradictory signals confuse search engines.
- Stale
lastmoddates. If every page shows the same date, search engines stop trusting the dates. - Broken URLs in the sitemap. URLs that return 404 or 500 errors waste crawl budget and signal poor site maintenance.
- Not referencing the sitemap in robots.txt. Without this reference, search engines might not find your sitemap at all.
- Including non-canonical URLs. If a page has a canonical tag pointing elsewhere, don’t include the non-canonical version.
How Do I Check My Sitemap?
You can visit /sitemap.xml directly in your browser to see if one exists, then check your robots.txt for a Sitemap: reference. But validating the contents — checking for broken URLs, noindex conflicts, and proper formatting — takes more work.
What seoutils.dev checks: Our free audit detects your sitemap at common locations, validates its XML format, checks the URL count, and verifies it’s properly referenced in your robots.txt.
Run a free audit to check your sitemap setup.
This is part of our Complete SEO Audit Checklist. Related: How to Create an Effective robots.txt File.