On-Page SEO
XML Sitemaps: How to Build, Submit and Use Them for SEO
An XML sitemap helps Google discover your pages. Learn how to create one on any platform, submit it in Search Console and use it to surface content gaps.
An XML sitemap is a file that lists the URLs on your website that you want search engines to crawl and index. It is a discovery aid, not a ranking signal: submitting a sitemap will not lift your rankings, but it tells Google at which pages exist so important new or neglected pages get found and indexed faster. For any site where pages are not all linked from the homepage, a well-maintained sitemap is a standard piece of hygiene.
Key Takeaways
- A sitemap helps discovery and indexing; it is not a ranking factor and does not guarantee that listed pages will be indexed.
- It matters most for new sites, sites with many pages, and sites whose important pages are only reachable through deep navigation (see technical SEO for bloggers).
- A sitemap should include only indexable URLs you actually want ranking, and should exclude noindexed, parameter, and low-value pages.
- Submit the sitemap in Google Search Console and monitor its Indexing reports for errors; a submitted sitemap is a diagnostic tool, not a one-time upload.
- Comparing your sitemap's pages against your impressions data surfaces exactly which content gaps are costing you traffic.
- Bigger is not better: Google imposes a 50,000 URL and 50MB limit per sitemap, and sitemap index files nest multiple sitemaps under one parent.
What an XML Sitemap Actually Does
Search engines discover URLs three ways: by following links, by reading your sitemap, and for some verticals, by other feeds. For small sites where everything is linked from the homepage, links are enough and the sitemap is redundant. For everything else, the sitemap fills the discovery gap.
Think of it as a delivery manifest rather than a request form. You are telling Google, these pages exist, here is where they live, and here is roughly how important each one is relative to the others. Google then decides what to crawl and index from its own judgement.
Where the Sitemap Lives
The conventional location is /sitemap.xml at your domain root. Search engines accept a sitemap submitted in Search Console regardless of path, but the /sitemap.xml convention means every crawler that checks the location automatically finds it.
You can also point Google to the sitemap from robots.txt:
Sitemap: https://www.example.com/sitemap.xml
Listing the Sitemap directive in robots.txt is a low-effort redundancy that helps crawlers that do not read Search Console submissions.
How to Create a Sitemap on Any Platform
- Static sites and hand-built sites: generate it with a build tool or a script that walks your routes. Many static site frameworks emit a sitemap at build time.
- WordPress: a plugin such as a well-maintained SEO plugin generates and updates the sitemap for you, including new posts automatically.
- Site generators and frameworks: use the framework's sitemap module and keep it in sync with your routing.
- If you have a small hand-maintained site, you can write the XML by hand for a few dozen URLs, though automation is better as the site grows.
Whatever the method, verify the output after every deploy: the most common sitemap failure is staleness, where the file lists pages that no longer exist or omits pages added since the last generation.
What to Include and Exclude
Include only URLs you want indexed:
- Posts, pages, and other canonical content.
- The canonical URL only for any content reachable via multiple paths (see the canonical URL guide).
- URLs that return 200s; a sitemap full of removed pages is a daily error log.
Exclude:
- Pages blocked by robots.txt or marked noindex.
- Internal search result pages, sort and filter combinations, parameter URLs, and paginated junk.
- Duplicate or near-duplicate variants.
Some guides recommend adding lastmod and priority fields. Google reads lastmod when it is accurate, so only include it if you can populate it truthfully. Priority is a relative hint between 0.0 and 1.0 and is largely informational in modern crawling.
Submitting and Monitoring in Search Console
Submit the sitemap under the Sitemaps report in Google Search Console and check the results:
- The Discovery status shows whether Google fetched it successfully.
- The Indexing report shows which submitted URLs were indexed, with reasons for those that were not.
- Add your primary sitemap; separate your sitemaps by type (posts versus pages) only if either exceeds a practical size.
The Search Console workflow beyond the sitemap, impressions analysis, and query-level decision-making, is covered in our Search Console content strategy guide.
Using the Sitemap to Find Content Gaps
The underappreciated use of a sitemap is as a diagnostic mirror. Cross-reference every URL it lists against your impressions data: pages that crawl and index but earn no impressions reveal keyword coverage gaps, while queries with impressions but no ranking pages reveal missing content.
Our walkthrough on finding content gaps from your sitemap turns this comparison into a repeatable process, which feeds directly into keyword research for the next batch of posts.
Sitemap Limits and Index Files
Each sitemap can contain up to 50,000 URLs and be no larger than 50MB uncompressed. Beyond that, split your URLs into multiple sitemaps and wrap them in a sitemap index file. Modern sitemaps should be gzipped (.xml.gz) to reduce bandwidth.
A sitemap index file is only two or three lines per child sitemap:
- A sitemapindex root element.
- One sitemap element with its loc per child.
Submitting the index file to Search Console is then sufficient; the children are crawled automatically.
Frequently Asked Questions
Does an XML sitemap improve rankings?
No, not directly. A sitemap helps Google discover and index your pages, which is a precondition for ranking, and it accelerates indexing for new or neglected pages. But it passes no quality signal and cannot make a low-quality page rank.
How often should my sitemap update?
Whenever your site changes: new posts, removed pages, moved URLs. The practical rule is to regenerate the sitemap as part of your deploy pipeline so it never lags the site. A stale sitemap is worse than none, because it wastes crawl effort on URLs that no longer exist.
Which URLs should be in my sitemap?
Only indexable pages you want ranked: canonical posts and pages returning 200s, in their canonical URL form. Exclude noindexed pages, search results, filters, parameters, and duplicates. Everything listed should be exactly what you want Google to spend its crawl on.
Is a sitemap essential for a small blog?
Not strictly. If every post is linked from your homepage or archives and your crawl is healthy, Google will find new posts anyway. A sitemap becomes worthwhile when posts are deep, when you publish in batches, or when you want the indexing diagnostics only a submitted sitemap gives you.