Skip to content

Commit

Permalink
fix(i18n): ensure right slashes in links urls
Browse files Browse the repository at this point in the history
  • Loading branch information
JB AUBREE committed May 22, 2024
1 parent 9746072 commit 531b224
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ export function getFormattedSitemap(options: ResolvedOptions, routes: string[])
if (options.i18n) {
const languages = options.i18n.languages.map(str => ({
lang: str,
url: str === options.i18n?.defaultLanguage ? url : `${url}/${str}`,
url: str === options.i18n?.defaultLanguage ? url : `${removeMaybeSuffix('/', url)}${ensurePrefix('/', str)}`,
}))
return Object.assign(formattedSitemap, {
links: options.i18n.defaultLanguage ? [...languages, { lang: 'x-default', url }] : languages,
})
return Object.assign(formattedSitemap, { links: options.i18n.defaultLanguage ? [...languages, { lang: 'x-default', url }] : languages })
}

return formattedSitemap
Expand Down

0 comments on commit 531b224

Please sign in to comment.