From 6314588bb1381d8bc17f380ce7fe6e2f02e41eae Mon Sep 17 00:00:00 2001 From: Adrian Marin Date: Fri, 7 Jun 2024 19:53:24 +0200 Subject: [PATCH] add canonnnical link to 3.0 --- docs/.vitepress/config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index 84891feb..74936e36 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -67,6 +67,18 @@ const config = { ['meta', { name:"msapplication-config", content:"/favicons/browserconfig.xml" }], ['meta', { name:"theme-color", content:"#ffffff" }], ], + transformPageData(pageData) { + const canonicalUrl = `https://docs.avohq.io/${pageData.relativePath}` + .replace(/index\.md$/, '') + .replace(/\.md$/, '.html') + .replace(/2\.0/, '3.0') + + pageData.frontmatter.head ??= [] + pageData.frontmatter.head.push([ + 'link', + { rel: 'canonical', href: canonicalUrl } + ]) + }, themeConfig: { siteTitle: false, logo: "/logo.svg",