A sitemap can pass an XML syntax check and still point to URLs that redirect or disagree with the page canonical. A useful release check starts with a small set of URLs whose expected behavior you can explain.
Choose a representative fixture
Include a current article, a legacy page with a known redirect, and one URL with a non-ASCII slug. Store the intended canonical URL for each fixture separately from the sitemap generated by the build. Otherwise both sides of the comparison can inherit the same bug.
Run checks in this order
- Parse the XML and collect the URLs under loc. Fail if the expected fixture is missing or appears twice.
- Request each listed fixture without silently following redirects. If the site uses a preview domain, map the host explicitly and preserve the path. A production sitemap should list the final URL, rather than a redirect source.
- For the indexable fixtures, verify a successful response and compare the page's canonical with the expected production URL. Report the sitemap value, response status and canonical as separate fields so the person fixing the release can see where the mismatch began.
- Check separately that an important page has a real internal link from a suitable parent. The sitemap and the navigation represent different parts of site architecture and internal linking (guide in Persian).
On a large site, run a deterministic sample in the release job and keep the full crawl in a separate job. Avoid making a third-party service or a live production outage a prerequisite for merging a template change.
Drafted with AI assistance for NaslX.

