Skip to content

Commit

Permalink
fix(seo): alternate links are required for every language
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Jun 10, 2024
1 parent 678978f commit 8fc635e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions composables/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function setPage<T extends KirbySharedPageData & Record<string, any>>(
}
})

// Add English link as `x-default` language
// Add primary locale as `x-default` for SEO
alternateUrls.push({
...alternateUrls.find((i) => i.hreflang === defaultLocale)!,
hreflang: 'x-default',
Expand All @@ -62,10 +62,7 @@ export function setPage<T extends KirbySharedPageData & Record<string, any>>(
})

useServerHead({
link: [
{ rel: 'canonical', href: url },
...alternateUrls.filter(({ hreflang }) => hreflang !== locale.value),
],
link: [{ rel: 'canonical', href: url }, ...alternateUrls],
})

useSeoMeta({
Expand Down

0 comments on commit 8fc635e

Please sign in to comment.