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:
@@ -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 }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user