From fd21bd2f835110813f92e11b686ae149cf9be0e5 Mon Sep 17 00:00:00 2001 From: Djeex Date: Tue, 11 Aug 2026 23:10:05 +0200 Subject: [PATCH] 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. --- plugins/canonical.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugins/canonical.ts diff --git a/plugins/canonical.ts b/plugins/canonical.ts new file mode 100644 index 0000000..1875bf5 --- /dev/null +++ b/plugins/canonical.ts @@ -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 } + ] + }) +})