N
Nuxt7mo ago
narr07

Nuxt Content (Document driven) and i18n

Is there a solution to this problem now? When it is not the default language, the data does not appear Document not found, overwrite this content with #not-found slot in <ContentDoc>. Config content: { locales: ['id', 'en'], defaultLocale: 'id' } Directory ---- --content ---id ---en ----- similiar to this: https://github.com/nuxt/content/issues/2003
GitHub
Document driven and i18n · Issue #2003 · nuxt/content
Is your feature request related to a problem? Please describe I was trying to use Document driven with localized content. the content structure is like this: en/ 1.company/ 1.about.md 2.team.md 2.n...
3 Replies
dwol
dwol7mo ago
try this,
<ContentDoc
class="prose prose-bcGov dark:prose-invert min-w-full"
:query="{
path: $route.path.replace(/^\/[a-zA-Z]{2}-[a-zA-Z]{2}\//, '/'),
where: { _locale: $i18n.locale }
}"
>
<ContentDoc
class="prose prose-bcGov dark:prose-invert min-w-full"
:query="{
path: $route.path.replace(/^\/[a-zA-Z]{2}-[a-zA-Z]{2}\//, '/'),
where: { _locale: $i18n.locale }
}"
>
You might have to adapt the regex to match your route
narr07
narr07OP7mo ago
Nope, the result same before
dwol
dwol7mo ago
Sorry not sure then, for mine I had to pass in a query matching the locale directory and the path matching what the content directory would be without the locale prefix. Maybe try manually typing in those values and see if that works. So if your content directory is content/en/my-route then it’d be: ‘:query=“{ path: ”/my-route”, where: { _locale: “en” } }”’ If not then 🤷‍♂️
Want results from more Discord servers?
Add your server