feat: add canonical URL and og:url

Docus doesn't generate canonical links or og:url natively. A plugin
now injects rel=canonical and og:url per route using nuxt-site-config's
withSiteUrl, which reads site.url from nuxt.config.ts.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Djeex
2026-08-11 23:10:26 +02:00
co-authored by Claude Sonnet 5
parent 2c28b27e82
commit 8ea1aca7a3
+13
View File
@@ -0,0 +1,13 @@
export default defineNuxtPlugin(() => {
const route = useRoute()
const canonicalUrl = withSiteUrl(computed(() => route.path), { canonical: true })
useHead({
link: [
{ rel: 'canonical', href: canonicalUrl }
],
meta: [
{ property: 'og:url', content: canonicalUrl }
]
})
})