nextjs-sitemap-generator icon indicating copy to clipboard operation
nextjs-sitemap-generator copied to clipboard

Support to excluding dynamic routes

Open yanmendes opened this issue 3 years ago • 1 comments

First, thanks for maintaining this project! Super useful.

I have the following project structure:

src
  ├── pages
  │   ├── [lang]
  │   │   └── content
  │   │       ├── [title]
  │   │       └── podcast
  │   │           ├── [slug]
  │   │           ├── author
  │   │           │   └── [uid]
  │   │           │       └── [pageNumber]
  │   │           ├── page
  │   │           │   └── [pageNumber]
  │   │           └── tag
  │   │               └── [tag]
  │   │                   └── [pageNumber]

I wish to dynamically exclude routes, like shown below:

  ignoredPaths: [
    'en/content/podcast/page/' // Works, but not ideal
    '[lang]/content/podcast/page/', // Doesn't work :(
  ]

Another feature suggestion that could mitigate this use case is allowing the usage of regexes.

yanmendes avatar Dec 17 '20 18:12 yanmendes

hey @yanmendes is it correct that you want to exclude all dynamic routes or only the placeholder (e.g., [pageNumber])? Because if you just want to exclude the placeholder you can try this:

ignoredPaths: ['[pageNumber]'],

But if you want to exclude all dynamic routes, I'm not sure. You'd have to try if something like this works:

ignoredPaths: ['page/[pageNumber]'],

meck93 avatar Dec 24 '20 06:12 meck93