nuxt-community / sitemap-module

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

Not able to use object props for dynamic routes #269

Open jydmnd opened 2 years ago

jydmnd commented 2 years ago

The ensureIsValidRoute function flattens dynamic routes objects so that only the route prop is used as the url. It would be useful to pass the entire object instead like with static routes, so some additional props could be used in the filter function. The route prop would have to be assigned to a url prop, something like this :

function ensureIsValidRoute(route) {
  route = typeof route === 'object' ? route : { url: route }

  if(route.route)
    route.url = route.route

  // force as string
  route.url = String(route.url)
  return route
}