Raw ampersands and angle brackets in URLs break XML parsing. The entry, sometimes the whole file, is rejected.
Must be entity-escaped inside <loc>:
— & → &amp;
— ' → &apos;
— " → &quot;
— > → &gt;
— < → &lt;
Also required:
— ✅ URLs percent-encode non-ASCII (use the IDN/punycode or %-form).
— ✅ Absolute URLs only, including scheme and host.
— ✅ The <loc> ≤ 2,048 characters.
Checklist:
Step 1 — Run the file through an XML validator, not just a sitemap linter.
Step 2 — Grep for raw & in loc values — common in URLs with query strings.
Definition of done: the file parses as well-formed XML with zero entity errors.
The Sitemap SOP
@SitemapSOP
Escape these five characters or fail validation
This post was published in the Telegram channel The Sitemap SOP (@SitemapSOP). All its posts are on the channel page.
Open on Telegram