What goes in a sitemap
Only the URLs you want in search results: canonical, indexable pages that return 200. Leave out redirects, noindexed pages, parameter duplicates and anything blocked in robots.txt. Every URL must be absolute and, per the sitemaps.org protocol, use the same protocol and host as the sitemap itself. That’s why the tool warns about http and https mixed together, www next to non-www, and hosts that differ from the rest of the list.
Limits and escaping
- 50,000 URLs and 50 MB (52,428,800 bytes) uncompressed per file. We split on whichever you hit first and write a sitemap index for the parts.
- Fewer than 2,048 characters per URL. Longer URLs are skipped and listed.
- UTF-8 and entity escaping. The five characters & ’ " < > are escaped, so a query string like
?a=1&b=2is written as?a=1&b=2. Pasting raw ampersands into a hand-written sitemap is the most common reason a file fails to parse.
lastmod: be accurate or leave it out
Google’s sitemap guide says it ignores <priority> and <changefreq>, and uses <lastmod> only if it’s consistently and verifiably accurate. So don’t stamp today’s date on every URL each time you rebuild. Export real modification dates from your CMS as url,lastmod and paste them in; we validate the W3C Datetime format (YYYY-MM-DD, or a full timestamp with a time zone) and flag future dates.
After you download
Upload the files to your site, add the Sitemap: line to robots.txt (build one with the robots.txt generator) and submit the sitemap or index in Search Console. Then run the live file through the sitemap checker to confirm it loads and parses. If you already have several sitemaps, the sitemap splitter and merger combines or splits them, and the sitemap index generator lists existing files.
A sitemap full of thin pages won’t help; we learned that the hard way. Read programmatic SEO without deindexing before you submit thousands of new URLs at once.