diff --git a/docs/content/2.sitemap/2.guides/0.filtering-urls.md b/docs/content/2.sitemap/2.guides/0.filtering-urls.md index a53728e..15c1a79 100644 --- a/docs/content/2.sitemap/2.guides/0.filtering-urls.md +++ b/docs/content/2.sitemap/2.guides/0.filtering-urls.md @@ -56,14 +56,25 @@ export default defineNuxtConfig({ }) ``` -These can be regex or a string path. +Either option supports either an array of strings, RegExp objects or a `{ regex: string }` object. -It's important to know that when providing a string, you can't use variable path segments in front of static ones. +Providing strings will use the [route rules path matching](https://nuxt.com/docs/guide/concepts/rendering#hybrid-rendering) which +does not support variable path segments in front of static ones. + +For example, `/foo/**` will work but `/foo/**/bar` will not. To get around this you should use regex. + +### Regex Filtering + +Filtering using regex is more powerful and can be used to match more complex patterns. It's recommended to pass a +`RegExp` object explicitly. ```ts [nuxt.config.ts] export default defineNuxtConfig({ sitemap: { - exclude: ['/**/secret-pages'], // this won't work + exclude: [ + // exclude /foo/**/bar using regex + new RegExp('/foo/.*/bar') + ], } }) ```