Sitemap doesn't render correctly when adding alternates
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
I have this weird issue with the sitemap I'm creating in Next.js. I have a
I tried to find the issue, and it seems like it's the alternates field. When I don't specify it, everything is fine, but as soon as I add it, the formatting breaks apart. There's a similar issue on Github (https://github.com/vercel/next.js/issues/66574), but in my case Google is actually failing to read the sitemap.
Any reason why this might be happening?
sitemap.ts
file, programatically create the sitemap based on data from the db. From a code perspective, everything looks fine. I don't get any TS errors or anything, but when I look at the sitemap, it seems like it's not valid XML. It doesn't get formatted like XML in my browser anyways, and Google says it can't read the sitemap. I tried to find the issue, and it seems like it's the alternates field. When I don't specify it, everything is fine, but as soon as I add it, the formatting breaks apart. There's a similar issue on Github (https://github.com/vercel/next.js/issues/66574), but in my case Google is actually failing to read the sitemap.
Any reason why this might be happening?
3 Replies
Cape lionOP
When I try to validate the sitemap here, it doesn't seem to be valid either: https://www.xml-sitemaps.com/validate-xml-sitemap.html
You can try with the sitemap: https://www.conjugio.com/sitemap/0.xml
Cape lionOP
I have resubmitted the Sitemap to Google and apparently, now it works. Maybe a weird parsing error that happened the first time