Files
docudjeex/plugins/canonical.ts
T
Djeex fd21bd2f83 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.
2026-08-11 23:10:26 +02:00

14 lines
308 B
TypeScript

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 }
]
})
})