nuxt-seo
nuxt-seo copied to clipboard
help: How to deactivate only i18n in "Best Practice Default Meta"
📚 What are you trying to do?
The language setting is worse than i18n! I use the SEO setup as described here: https://i18n.nuxtjs.org/docs/guide/seo/ in layout/default.vue. It works very nice and sets the right lang even on serverside. (To note: I use the no_prefix mode and a bit of a special setup with i18n, but it works and the locale is set on the serverside)
But the default meta overwrites it with the wrong language and it only gets corrected on the client. (But i want to have the other stuff, especially the canonical url)
Or is there a way to give Nuxt SEO the right locale somewhere?
<div class="flex min-h-screen flex-col">
<Html
:lang="head.htmlAttrs ? head.htmlAttrs.lang : ''">
<Head>
<template v-for="meta in head.meta" :key="meta.id">
<Meta
v-if="
meta.property === 'og:locale' || meta.property === 'og:locale:alternate'
"
:id="meta.id"
:property="meta.property"
:content="meta.content" />
</template>
</Head>
<Body>
<MenuHeader />
<main class="body-height z-0 flex-1">
<slot />
</main>
<MenuFooter />
</Body>
</Html>
</div>
</template>
<script lang="ts" setup>
// SEO Stuff from i18n, because Nuxt SEO sets wrong server side lang
const head = useLocaleHead();
</script>```