Skip to content

Commit

Permalink
fix: maybe fix import bug
Browse files Browse the repository at this point in the history
Related #94
  • Loading branch information
harlan-zw committed Aug 19, 2023
1 parent f3768b6 commit 5029be1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ export default defineNuxtModule<ModuleOptions>({
autoLastmod: config.autoLastmod,
defaultLocale: nuxtI18nConfig.defaultLocale || 'en',
strategy: nuxtI18nConfig.strategy || 'no_prefix',
routeNameSeperator: nuxtI18nConfig.routesNameSeparator,
})
: []
resolve(payload)
Expand Down
8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface NuxtPagesToSitemapEntriesOptions {
}

export function convertNuxtPagesToSitemapEntries(pages: NuxtPage[], config: NuxtPagesToSitemapEntriesOptions) {
config.routeNameSeperator = config.routeNameSeperator || '__'
const routeNameSeperator = config.routeNameSeperator || '__'
const flattenedPages = pages
.map((page) => {
return page.children?.length
Expand Down Expand Up @@ -43,9 +43,9 @@ export function convertNuxtPagesToSitemapEntries(pages: NuxtPage[], config: Nuxt
})

const localeGropes = {}
pagesWithMeta.reduce((acc, entry) => {
if (entry.page.name.includes(config.routeNameSeperator)) {
let [name, locale] = entry.page.name.split(config.routeNameSeperator)
pagesWithMeta.reduce((acc: Record<string, any>, entry) => {
if (entry.page.name?.includes(routeNameSeperator)) {
let [name, locale] = entry.page.name.split(routeNameSeperator)
if (locale)
locale = locale.slice(1)
if (!acc[name])
Expand Down

0 comments on commit 5029be1

Please sign in to comment.