import type { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://acme.com',
lastModified: new Date(),
alternates: {
languages: {
es: 'https://acme.com/es',
de: 'https://acme.com/de',
},
},
},
{
url: 'https://acme.com/about',
lastModified: new Date(),
alternates: {
languages: {
es: 'https://acme.com/es/about',
de: 'https://acme.com/de/about',
},
},
},
{
url: 'https://acme.com/blog',
lastModified: new Date(),
alternates: {
languages: {
es: 'https://acme.com/es/blog',
de: 'https://acme.com/de/blog',
},
},
},
]
}
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/mystifying-newton-42cjqp?file=%2Fapp%2Fsitemap.ts
To Reproduce
yarn next devUncaught TypeError: Cannot read properties of null (reading 'childNodes')Current vs. Expected behavior
The sitemap.xml should normally render correctly, but it renders plain text:
https://acme.com 2024-05-15T20:48:04.146Z https://acme.com/about 2024-05-15T20:48:04.146Z https://acme.com/blog 2024-05-15T20:48:04.146Z. The error happens only if I set thealternatesattribute! Withoutalternatesit work's like a charm.Provide environment information
Which area(s) are affected? (Select all that apply)
Metadata
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response