Skip to content

Commit ef7911b

Browse files
committed
feat(client): config nav support custom rel
1 parent 77f0a72 commit ef7911b

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const props = defineProps<{
88
href?: string
99
noIcon?: boolean
1010
target?: string
11+
rel?: string
1112
}>()
1213
1314
const isExternal = computed(() => props.href && EXTERNAL_URL_RE.test(props.href))
@@ -20,7 +21,7 @@ const isExternal = computed(() => props.href && EXTERNAL_URL_RE.test(props.href)
2021
:class="{ link: href }"
2122
:href="href ? normalizeLink(href) : undefined"
2223
:target="target || (isExternal ? '_blank' : undefined)"
23-
:rel="isExternal ? 'noreferrer' : undefined"
24+
:rel="rel || (isExternal ? 'noreferrer' : undefined)"
2425
>
2526
<slot />
2627
<VPIconExternalLink v-if="isExternal && !noIcon" class="icon" />

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

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const { page } = useData()
1616
:class="{ active: isActive(page.relativePath, item.activeMatch || item.link) }"
1717
:href="item.link"
1818
:target="item.target"
19+
:rel="item.rel"
1920
>
2021
{{ item.text }}
2122
</VPLink>

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

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const { page } = useData()
2424
:href="item.link"
2525
:target="item.target"
2626
:noIcon="true"
27+
:rel="item.rel"
2728
>
2829
{{ item.text }}
2930
</VPLink>

types/default-theme.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export namespace DefaultTheme {
9797
*/
9898
activeMatch?: string
9999
target?: string
100+
rel?: string
100101
}
101102

102103
export type NavItemChildren = {

0 commit comments

Comments
 (0)