Skip to content

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

@Fabioni

Description

@Fabioni

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions