Skip to content

Commit f09593b

Browse files
authored
fix(theme): add rel="alternate" and hreflang to links in language menu (#5108)
1 parent a01bba0 commit f09593b

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/client/theme-default/components/VPMenuLink.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import VPLink from './VPLink.vue'
77
88
const props = defineProps<{
99
item: T
10+
rel?: string
1011
}>()
1112
1213
const { page } = useData()
@@ -33,7 +34,7 @@ defineOptions({ inheritAttrs: false })
3334
}"
3435
:href
3536
:target="item.target"
36-
:rel="item.rel"
37+
:rel="props.rel ?? item.rel"
3738
:no-icon="item.noIcon"
3839
>
3940
<span v-html="item.text"></span>

src/client/theme-default/components/VPNavBarExtra.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ const hasExtraContent = computed(
3131
<p class="trans-title">{{ currentLang.label }}</p>
3232

3333
<template v-for="locale in localeLinks" :key="locale.link">
34-
<VPMenuLink :item="locale" :lang="locale.lang" :dir="locale.dir" />
34+
<VPMenuLink
35+
:item="locale"
36+
:lang="locale.lang"
37+
:hreflang="locale.lang"
38+
rel="alternate"
39+
:dir="locale.dir"
40+
/>
3541
</template>
3642
</div>
3743

src/client/theme-default/components/VPNavBarTranslations.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ const { localeLinks, currentLang } = useLangs({ correspondingLink: true })
1919
<p class="title">{{ currentLang.label }}</p>
2020

2121
<template v-for="locale in localeLinks" :key="locale.link">
22-
<VPMenuLink :item="locale" :lang="locale.lang" :dir="locale.dir" />
22+
<VPMenuLink
23+
:item="locale"
24+
:lang="locale.lang"
25+
:hreflang="locale.lang"
26+
rel="alternate"
27+
:dir="locale.dir"
28+
/>
2329
</template>
2430
</div>
2531
</VPFlyout>

0 commit comments

Comments
 (0)