This is my sitemap.ts file which I took from Next documentation: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap#generate-a-localized-sitemap
import { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://acme.com',
lastModified: new Date(),
alternates: {
languages: {
es: 'https://acme.com',
en: 'https://acme.com/en',
},
},
}
]
}
but when I visit the url/sitemap.xml it returns this:
https://acme.com 2024-06-12T09:41:57.545Z
Is there any way to fix this?
Thank you!
When I remove the “alternates” snippet and keep the rest, the sitemap works as expected.
New contributor
user21313422 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.