mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What Fixes the string id that broken when sitemap is optimized to static route. ### Why When sitemap is optimized to static route in production, the route argument is changed from `[[...__metadata_id__]]` to `[__metadata_id__]`, so the type of it is also changed from array to string that should reflect in the loader code. Fixes #60894 Closes NEXT-2154
24 lines
465 B
TypeScript
24 lines
465 B
TypeScript
import { MetadataRoute } from 'next'
|
|
|
|
export async function generateSitemaps() {
|
|
return [
|
|
{ id: 'child0' },
|
|
{ id: 'child1' },
|
|
{ id: 'child2' },
|
|
{ id: 'child3' },
|
|
]
|
|
}
|
|
|
|
export default function sitemap({ id }): MetadataRoute.Sitemap {
|
|
return [
|
|
{
|
|
url: `https://example.com/dynamic/${id}`,
|
|
lastModified: '2021-01-01',
|
|
},
|
|
{
|
|
url: `https://example.com/dynamic/${id}/about`,
|
|
lastModified: '2021-01-01',
|
|
},
|
|
]
|
|
}
|