Closed rcluis closed 1 year ago
The sitemap will not be prerendered when you use nuxt build
. It will be generated at runtime?
If I'm misunderstanding, then maybe try out the new v4 release and you can clarify further if you still have issues.
but if you have some pages pre-generated by configuration, I think the ideal is for the sitemap.xml to be created once the build
command is run. I'm testing v4 and is the same thing.
I have to run npm run generate
to generate the sitemap.
Couldn't we have a separate command to generate the sitemap at will?
I don't follow your logic sorry. Why is the ideal to generate it at build time? This would break any sitemap using dynamic URLs. Is there an issue you're facing generating it at runtime?
If you want to prerender it at build just add it to the prerender list
export default defineNuxtConfig({
nitro: {
prerender: {
routes: ['/sitemap.xml']
}
}
})
I understand. In my case in concrete, I have everything generated with statics (prerender) except one route, which is SSR. Therefore, what I expect is that the sitemap of all the static ones is generated except for that specific route.
Don't know if it's the best, but at least it's what I would expect when running the npm run build
command.
Describe the bug
This is my sitemap configuration:
Then I have the site url:
When I run
nuxt generate
it outputs the sitemap properly, but when I runnuxt build
the sitemap is not there.Reproduction
No response
System / Nuxt Info