Skip to content

Commit

Permalink
fix: i18n prefix_and_default canonical path without prefix
Browse files Browse the repository at this point in the history
Fixes #166
  • Loading branch information
harlan-zw committed Jul 1, 2024
1 parent 262eb8e commit c92e9dc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/util/nuxtSitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ export function convertNuxtPagesToSitemapEntries(pages: NuxtPage[], config: Nuxt
return p
})

if (config.strategy === 'prefix_and_default') {
// filter out any pages started with the default locale
flattenedPages = flattenedPages.filter((p) => {
if (p.page?.name) {
const [, locale] = p.page.name.split(routesNameSeparator)
return locale !== config.defaultLocale || p.page.name.endsWith('__default')
}
return true
})
}

const pagesWithMeta = flattenedPages.map((p) => {
if (config.autoLastmod && p.page!.file) {
try {
Expand Down

0 comments on commit c92e9dc

Please sign in to comment.