Skip to content

Commit

Permalink
seo: Create canonical link in headers
Browse files Browse the repository at this point in the history
This removes the duplicate pages from search engines and helps getting more people to find FlowFuse Dashboard.
  • Loading branch information
ZJvandeWeg committed Feb 6, 2024
1 parent 130622c commit 8d3391b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ export default ({ mode }) => {
"window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'G-MNGVF5NCF7');",
],
],
transformPageData(pageData) {
const canonicalUrl = `https://dashboard.flowfuse.com/${pageData.relativePath}`
.replace(/index\.md$/, '')
.replace(/\.md$/, '.html')

pageData.frontmatter.head ??= []
pageData.frontmatter.head.push([
'link',
{ rel: 'canonical', href: canonicalUrl }
])
},
themeConfig: {
logo: '/logo.png',
nav: [
Expand Down

0 comments on commit 8d3391b

Please sign in to comment.