Skip to content

Commit

Permalink
fix: remove query parameters for alternate links
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede committed Feb 4, 2025
1 parent 3718e30 commit 7074072
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime/routing/head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ export function getHreflangLinks(
localeMap.set(localeLanguage, locale)
}

const routeWithoutQuery = common.router.resolve({ query: {} })
for (const [language, mapLocale] of localeMap.entries()) {
const localePath = switchLocalePath(common, mapLocale.code)
const localePath = switchLocalePath(common, mapLocale.code, routeWithoutQuery)
const canonicalQueryParams = getCanonicalQueryParams(common, seo)
let href = toAbsoluteUrl(localePath, baseUrl)
if (canonicalQueryParams) {
Expand All @@ -128,7 +129,7 @@ export function getHreflangLinks(
}

if (defaultLocale) {
const localePath = switchLocalePath(common, defaultLocale)
const localePath = switchLocalePath(common, defaultLocale, routeWithoutQuery)
const canonicalQueryParams = getCanonicalQueryParams(common, seo)
let href = toAbsoluteUrl(localePath, baseUrl)
if (canonicalQueryParams) {
Expand Down

0 comments on commit 7074072

Please sign in to comment.