Nuxt-Content and Nuxt I18n: How to create a localized content
I am working on a Nuxt.js project that uses @nuxt/content and @nuxtjs/i18n modules to create a localized blog.
If I use content/blog/hellow-world.md the page works fine and the content gets fetched just fine, but if I tried to localize the content folder by creating separate language folders like this: content/en/blog/hellow-world.md and changing the fetching method inside blog/index file to include the locale like this:
const i18n = useI18n()
const {data: posts} = await useAsyncData('get-all-posts', () => {
return queryContent(i18n.locale.value + '/blog').sort({date: -1}).find()
})
then the blog posts are not shown, and I get 404 (Document not found!)
This is the repo link: https://github.com/abdurrahmanseyidoglu/personal-website-nuxt
and this is the question on stackoverflow (I tried to post all the details here, but unfortunately, there is a character limit) :
https://stackoverflow.com/questions/78843859/nuxt-js-content-and-nuxt-i18n-how-to-create-a-localized-content
GitHub
https://abdurrahmanseyidoglu.com/. Contribute to abdurrahmanseyidoglu/personal-website-nuxt development by creating an account on GitHub.
Stack Overflow
Nuxt.js Content and Nuxt I18n: How to create a localized content
I am working on a Nuxt.js project that uses @nuxt/content and @nuxtjs/i18n modules to create a localized blog.
If I use content/blog/hellow-world.md
the page works fine and the content gets fetched...
0 Replies