Skip to content

Commit

Permalink
Add canonical URLs for SEO
Browse files Browse the repository at this point in the history
  • Loading branch information
skirtles-code committed Jan 17, 2024
1 parent 5d97409 commit d989132
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ export default defineConfigWithTheme({
description: 'Examples of Vue patterns and basic components',
appearance: false,

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

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

themeConfig: {
search: {
provider: 'local'
Expand Down

0 comments on commit d989132

Please sign in to comment.