Sitemap.xml incorrect

Problem: My live sitemap URL, https://www.remakeit.se/sitemap.xml, is consistently serving incorrect plain text content, even though my build process successfully generates the correct XML content for this file.

Details & Evidence:

  1. Successful Deploy: My latest build completed successfully.
  2. Correct XML Generated (Proven by Log): My build command (npm run build && node ./generate-sitemap.cjs) includes a script to generate the sitemap. As shown in the deploy log linked above, I added debug logging. Between the markers --- Sitemap Content START --- and --- Sitemap Content END ---, the log clearly prints the correctly formatted XML content that the script generated in memory just before attempting to write it to the file. This XML includes proper <urlset>, <url>, <loc>, and <xhtml:link hreflang="..."> tags for both ‘sv’ and ‘en’ languages.
  3. Incorrect Deployed File Content: However, when I download the sitemap.xml file directly from the “Deploy file browser” section for the exact same successful deploy linked above, the downloaded file contains incorrect plain text data (listing only Swedish URLs without XML tags, and incorrect dates) – completely different from the XML content proven to be generated in the log.
  4. Troubleshooting Performed:
  • I have confirmed my netlify.toml file contains only standard SPA fallback rules and the correct build command, with no specific rules targeting /sitemap.xml.
  • I have performed a “Clear cache and deploy site” action via the Netlify UI for the relevant deploy.
  • I have tested the live URL https://www.remakeit.se/sitemap.xml in incognito/private browser windows and using mobile data (different network) – the incorrect plain text content is still served consistently.
  • I have confirmed the static file public/sitemap.xml has been removed from my repository.

Request:

Could you please investigate why the content of the deployed dist/sitemap.xml file (as confirmed by downloading it) does not match the XML data that the build script successfully generated according to the deploy log?

It appears there might be an issue with how fs.writeFileSync behaves in the build environment (failing silently after logging?), or an issue with how the sitemap.xml file is being handled/served post-build by the Netlify platform or CDN for this specific path, overriding the correctly generated file content.

Please let me know if you need any further information, like the downloaded incorrect sitemap file.

Thank you for your help in resolving this strange issue.

Sincerely,
Marcus

It’s served as XML 68030c183668c60008bb5825–remakeit.netlify.app/sitemap.xml:

Where does it seem to be served as a plain text?

when i type www.remakeit.se/sitemap.xml i get:


It does not render the correct xml format, or site map.

That’s just how the browser is rendering it, Netlify doesn’t control it. If you see your sitemap here:

view-source:https://www.remakeit.se/sitemap.xml

it appears correct.

Okay, good news. But why does google not find all the pages on the sitemap.xml? It only shows 12 pages?