diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 25c4a72..e4f30a3 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -109,9 +109,6 @@ export default withMermaid(defineConfig({ ['meta', { name: 'keywords', content: 'plane, api, self-hosting, project management, developer documentation, kubernetes, docker, rest api, webhooks, plane api' }], ['meta', { name: 'theme-color', content: '#3b82f6' }], - // SEO: Canonical URL - ['link', { rel: 'canonical', href: 'https://developers.plane.so' }], - // Open Graph meta tags ['meta', { property: 'og:type', content: 'website' }], ['meta', { property: 'og:title', content: 'Developer documentation | Plane' }], @@ -126,6 +123,19 @@ export default withMermaid(defineConfig({ ['meta', { name: 'twitter:image', content: 'https://media.docs.plane.so/logo/og-docs.webp' }], ], + transformPageData(pageData) { + const head = pageData.frontmatter.head ??= [] + const hasCanonical = head.some( + ([tag, attrs]) => tag === 'link' && attrs?.rel === 'canonical' + ) + if (!hasCanonical) { + const canonicalUrl = `https://developers.plane.so/${pageData.relativePath}` + .replace(/index\.md$/, '') + .replace(/\.md$/, '') + head.push(['link', { rel: 'canonical', href: canonicalUrl }]) + } + }, + themeConfig: { siteTitle: false, logo: {