Skip to content

Commit 038013a

Browse files
committed
Add canonical URL links
1 parent e85bdde commit 038013a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/.vitepress/config.mts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ export default defineConfig({
1111
hostname: 'https://vue-land.github.io'
1212
},
1313

14+
transformHead({ page}) {
15+
if (page !== '404.md') {
16+
const canonicalUrl = `https://vue-land.github.io/${page}`
17+
.replace(/index\.md$/, '')
18+
.replace(/\.md$/, '')
19+
20+
return [['link', { rel: 'canonical', href: canonicalUrl }]]
21+
}
22+
},
23+
1424
themeConfig: {
1525
logo: '/logo.svg',
1626

0 commit comments

Comments
 (0)