This package fixes invalid XML responses and auto-builds sitemap_index.xml at runtime by scanning which sitemap_small*.xml files exist.
- Forces correct headers for all
sitemap*.xmlandrobots.txt. - Serves them as static assets (no SPA/HTML preload).
- Dynamically generates
/sitemap_index.xmlby probingsitemap_small1..300.xmland also rootsitemap{1,2,3}.xml. Adjust the range in_worker.jsif needed.
- Put
_worker.js,_headers,_routes.json,robots.txtin your repo root. - Commit & deploy to Cloudflare Pages.
curl -I https://<your-domain>/sitemap_small1.xml # Content-Type: application/xml
curl -I https://<your-domain>/sitemap_small41.xml # Content-Type: application/xml
curl -I https://<your-domain>/robots.txt # Content-Type: text/plain
curl https://<your-domain>/sitemap_index.xml # Should contain entries for all existing sitemaps
If you have more than 300 small files, bump SMALL_MAX in _worker.js.