feat: add canonical URL and og:url

Docus doesn't generate canonical links or og:url natively. This
branch has no @nuxtjs/sitemap/nuxt-site-config, so the plugin reads
the base URL from docus.url in app.config.ts (already includes the
/fr prefix) instead of hardcoding it, and combines it with the
current route path.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Djeex
2026-08-11 23:14:20 +02:00
co-authored by Claude Sonnet 5
parent a36b3c7c2a
commit 921780d0d2
+14
View File
@@ -0,0 +1,14 @@
export default defineNuxtPlugin(() => {
const route = useRoute()
const { docus } = useAppConfig()
const canonicalUrl = computed(() => `${docus.url}${route.path}`)
useHead({
link: [
{ rel: 'canonical', href: canonicalUrl }
],
meta: [
{ property: 'og:url', content: canonicalUrl }
]
})
})