I was wondering if anyone knows how to get the sitemap.xml functionality working in Spartacus site like how it was working in yacceleratorstorefront/sitemap.xml.
Looks like SAP Commerce Support team is still having this functionality in their roadmaps. But we need to implement sitemap.xml for making the site live
We tried implementing the sitemap.xml in same way like other pages in Spartacus site. But it is getting rendered as HTML if we view the source. But we need to load the sitemap.xml file in XML format only when we view the source.
Any help would be much appreciated. Thank you :)
Serving Spartacus-based site is a bit complicated. There are other workarounds.
First suggestion: Use SAP Commerce capabilities to generate
sitemap.xmlfiles. Save them to your web server and configure your web server (Nginx/Apache) to serve them at your backend.Source for the docs
Second suggestion If your Spartacus storefront is running on an Express.js or Node.js server, modify it to serve your sitemap.xml file. Use a task scheduler to generate the
sitemap.xmlfile regularly and save it to your server.