How to Generate an XML Sitemap Correctly in 2026

Updated 2026-03-27 · By SPUNK13 · Back to spunk.bet

A sitemap is a discovery hint, not a ranking input. Getting it right is mostly about honesty and hard limits, and getting it wrong usually means search engines stop trusting the file entirely.

The hard limits

A single sitemap file holds a maximum of 50,000 URLs and must not exceed 50 MB uncompressed. Gzip is allowed and encouraged; the 50 MB limit applies to the decompressed size. Above either limit, split the file and reference the parts from a sitemap index — which is itself capped at 50,000 sitemaps. All URLs in a sitemap must be fully qualified, must use the same protocol and host as the sitemap's own location, and must be URL-encoded (ampersands as &).

lastmod is the field that matters

Search engines use lastmod when it is credible and ignore it entirely when it is not. Credible means it changes when the page's meaningful content changes, and does not change when you redeploy the site. The single most common generator bug is stamping every URL with the build time, which makes the field worthless within days. Use the W3C datetime format — a plain 2026-08-09 is valid, and 2026-08-09T14:32:00+00:00 is better when you publish frequently.

changefreq and priority are ignored by the major engines. Emitting them is harmless but pointless; the effort is better spent making lastmod accurate.

What belongs in the file

Only canonical, indexable, 200-status URLs. Every entry that is redirected, noindexed, canonicalised elsewhere, blocked by robots.txt, or returning a 404 is a contradiction between two signals you are sending, and a sitemap full of contradictions gets treated as unreliable. Do not include parameter variants, filtered listing pages, or paginated duplicates. If a page is not good enough to index, it is not good enough for the sitemap.

Generating it

Submission and discovery

Add Sitemap: https://example.com/sitemap.xml to robots.txt — that line is read by every major crawler and is the only discovery method that works without an account. Then submit the index in Search Console and Bing Webmaster Tools, which is where you get the useful feedback: how many submitted URLs are actually indexed. A large gap between submitted and indexed is a content quality signal, not a sitemap bug.

Checking it before you ship

Validate the XML parses (xmllint --noout sitemap.xml), confirm the file is served as application/xml and not text/html, spot-check ten URLs for a 200 status and a self-referencing canonical, and confirm the URL count matches the number of pages you believe you have. A sitemap listing 12,000 URLs on a site with 900 pages means a generator is emitting parameter combinations — fix the generator, not the sitemap.

Want More?

Explore our complete collection of free tools and resources.

Visit spunk.bet
400+ Free Tools Free Casino Meme Generator Birth Charts Scam Database BPM Calculator