nuxt-community / sitemap-module

Sitemap Module for Nuxt 2
https://sitemap.nuxtjs.org
MIT License
688 stars 127 forks source link

if sitemap.routes is specified generator.routes is not used anymore #259

Open Fabioni opened 2 years ago

Fabioni commented 2 years ago

Hello, in the documentation (https://sitemap.nuxtjs.org/usage/sitemap) is written

For dynamic routes (eg. /pages/_id.vue), you have to declare them with the routes property. This option can be an array or a function. In addition, the routes defined in generate.routes will be automatically used for the sitemap.

This is misleading since in addition is wrong. As seen here https://github.com/nuxt-community/sitemap-module/blob/dev/lib/options.js#L24 nuxtInstance.options.generate.routes is only taken as default option if sitemap.routes is not specified. So we should either change the documentation or the functionality. Personally I would like to have the behavior that the generate.routes are always taken, and I can additional specify routes in the sitemap options that are used together with the ones from generate.routes.

The use case that I have is that I do not want all pages pre-generated, but I want them all shown in the sitemap.xml file.

Is there maybe a simple way I can get this behavior. Both, sitemap.routes and generate.routes, are async functions in my case.