We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a839c14 commit cc388d9Copy full SHA for cc388d9
1 file changed
docs/.vitepress/config.ts
@@ -331,5 +331,16 @@ export default defineConfig({
331
level: [2, 3],
332
},
333
334
+ transformPageData(pageData) {
335
+ const canonicalUrl = `${ogUrl}/${pageData.relativePath}`
336
+ .replace(/\/index\.md$/, '/')
337
+ .replace(/\.md$/, '/')
338
+ pageData.frontmatter.head ??= []
339
+ pageData.frontmatter.head.unshift([
340
+ 'link',
341
+ { rel: 'canonical', href: canonicalUrl },
342
+ ])
343
+ return pageData
344
+ },
345
buildEnd,
346
})
0 commit comments