Skip to content

Commit d989132

Browse files
committed
Add canonical URLs for SEO
1 parent 5d97409 commit d989132

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/.vitepress/config.mjs

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ export default defineConfigWithTheme({
99
description: 'Examples of Vue patterns and basic components',
1010
appearance: false,
1111

12+
transformHead({ page, siteData: { base } }) {
13+
if (page !== '404.md') {
14+
const canonicalUrl = `https://skirtles-code.github.io${base}${page}`
15+
.replace(/index\.md$/, '')
16+
.replace(/\.md$/, '')
17+
18+
return [['link', { rel: 'canonical', href: canonicalUrl }]]
19+
}
20+
},
21+
1222
themeConfig: {
1323
search: {
1424
provider: 'local'

0 commit comments

Comments
 (0)