Skip to content

Commit

Permalink
Add canonical URL links
Browse files Browse the repository at this point in the history
  • Loading branch information
skirtles-code committed Jan 18, 2024
1 parent e85bdde commit 038013a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ export default defineConfig({
hostname: 'https://vue-land.github.io'
},

transformHead({ page}) {
if (page !== '404.md') {
const canonicalUrl = `https://vue-land.github.io/${page}`
.replace(/index\.md$/, '')
.replace(/\.md$/, '')

return [['link', { rel: 'canonical', href: canonicalUrl }]]
}
},

themeConfig: {
logo: '/logo.svg',

Expand Down

0 comments on commit 038013a

Please sign in to comment.