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.
14 lines
308 B
TypeScript
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 }
|
|
]
|
|
})
|
|
})
|