mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What * Remove the erroring of force-dynamic is not able to use during static generation * Export the route segments properly in sitemap conventions ### Why We discovered this error is showing up when users are using force-dynamic with generating multi sitemaps. When you have a dynamic `route /[id]/route.js` , and you have generateSitemaps defined which is actually using `generateSitemaps` under the hood , then you set the route to dynamic with `export dynamic = 'force-dynamic'`. We should keep the route still as dynamic. `generateStaticParams` is only for generating the paths, which is static in build time. And the `force-dynamic` is going to be applied to each generated path. Closes NEXT-2881
23 lines
439 B
JavaScript
23 lines
439 B
JavaScript
export default function sitemap() {
|
|
return [
|
|
{
|
|
url: 'https://acme.com',
|
|
lastModified: new Date(),
|
|
changeFrequency: 'secondly',
|
|
priority: 1,
|
|
},
|
|
{
|
|
url: 'https://acme.com/about',
|
|
lastModified: new Date(),
|
|
changeFrequency: 'secondly',
|
|
priority: 0.8,
|
|
},
|
|
]
|
|
}
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export async function generateSitemaps() {
|
|
return [{ id: 0 }, { id: 1 }]
|
|
}
|