In this guide
An XML sitemap is a list of the pages you want search engines to find. It does not guarantee indexing, but it helps new and deep pages get discovered, and it is the first place to look when pages go missing.
Key takeaways
- A sitemap lists the pages you want found; it helps discovery but does not guarantee indexing.
- List only final addresses that answer 200 and are meant to be indexed.
- Each file holds at most 50,000 addresses; larger sites use a sitemap index.
- Add the sitemap to robots.txt and submit it in Search Console.
What belongs in a sitemap
- Only pages that answer 200 and that you want in search results.
- The final address of each page: https, the right www choice, no redirects.
- Not pages with noindex, not pages whose canonical points elsewhere, not search or filter results.
Limits and format
- At most 50,000 addresses and 50 MB (uncompressed) per sitemap file.
- Larger sites use a sitemap index that lists several sitemap files.
<lastmod>should be the real date the content changed; Google ignores it if it is always today.<priority>and<changefreq>are ignored by Google; they do no harm.
Common errors
- The sitemap lists http or non-www addresses that redirect.
- Deleted pages still listed, returning 404.
- The file is served as HTML (an error page) instead of XML.
- robots.txt points to an old sitemap address.
Validate and submit
- Run the XML sitemap validator on your sitemap address.
- Fix any invalid entries, redirects or errors it lists.
- Add a
Sitemap:line with the full address to robots.txt. - Submit the sitemap in Google Search Console and Bing Webmaster Tools.
Checklist
- Run the XML sitemap validator on your sitemap address.
- Remove addresses that redirect, return errors or carry noindex.
- Use real modification dates in lastmod, or leave them out.
- Add a Sitemap: line to robots.txt.
- Submit it in Google Search Console and Bing Webmaster Tools.
Questions
Do small websites need a sitemap?
Not strictly, if every page is linked from the menu. It still helps, costs nothing, and most CMSs make one automatically.
Where should the sitemap live?
Usually at /sitemap.xml at the root of the site. Wherever it is, list it in robots.txt.