Skip to content

Commit d8a8468

Browse files
fix: canonical links
1 parent 419827f commit d8a8468

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/.vitepress/config.mts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ export default withMermaid(defineConfig({
109109
['meta', { name: 'keywords', content: 'plane, api, self-hosting, project management, developer documentation, kubernetes, docker, rest api, webhooks, plane api' }],
110110
['meta', { name: 'theme-color', content: '#3b82f6' }],
111111

112-
// SEO: Canonical URL
113-
['link', { rel: 'canonical', href: 'https://developers.plane.so' }],
114-
115112
// Open Graph meta tags
116113
['meta', { property: 'og:type', content: 'website' }],
117114
['meta', { property: 'og:title', content: 'Developer documentation | Plane' }],
@@ -126,6 +123,18 @@ export default withMermaid(defineConfig({
126123
['meta', { name: 'twitter:image', content: 'https://media.docs.plane.so/logo/og-docs.webp' }],
127124
],
128125

126+
transformPageData(pageData) {
127+
const canonicalUrl = `https://developers.plane.so/${pageData.relativePath}`
128+
.replace(/index\.md$/, '')
129+
.replace(/\.md$/, '')
130+
131+
pageData.frontmatter.head ??= []
132+
pageData.frontmatter.head.push([
133+
'link',
134+
{ rel: 'canonical', href: canonicalUrl }
135+
])
136+
},
137+
129138
themeConfig: {
130139
siteTitle: false,
131140
logo: {

0 commit comments

Comments
 (0)