Skip to content

Commit

Permalink
fix: support root sitemaps path prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Nov 24, 2024
1 parent 4965d32 commit 334a4f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ declare module 'vue-router' {
if (typeof config.sitemaps === 'object') {
for (const k in config.sitemaps) {
nuxt.options.nitro.routeRules[joinURL(config.sitemapsPathPrefix, `/${k}.xml`)] = routeRules
nuxt.options.nitro.routeRules[`/${k}-sitemap.xml`] = { redirect: joinURL(config.sitemapsPathPrefix, `${k}.xml`) }
if (config.sitemapsPathPrefix && config.sitemapsPathPrefix !== '/') {
nuxt.options.nitro.routeRules[`/${k}-sitemap.xml`] = { redirect: joinURL(config.sitemapsPathPrefix, `${k}.xml`) }
}
}
}
else {
Expand Down

0 comments on commit 334a4f7

Please sign in to comment.