feat(05): i18n strategy prefix — /fr/blog and /en/blog explicit routes, update collection prefixes

This commit is contained in:
2026-04-21 16:49:32 +02:00
parent 06f47cbe11
commit 277b407361
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -5,8 +5,8 @@ const route = useRoute()
const slug = Array.isArray(route.params.slug) ? route.params.slug.join('/') : route.params.slug
const isFr = locale.value === 'fr'
const collection = isFr ? 'blog_fr' : 'blog_en'
// blog_fr prefix = /blog, blog_en prefix = /en/blog (aligned with content.config.ts)
const path = isFr ? `/blog/${slug}` : `/en/blog/${slug}`
// blog_fr prefix = /fr/blog, blog_en prefix = /en/blog (aligned with content.config.ts)
const path = isFr ? `/fr/blog/${slug}` : `/en/blog/${slug}`
const { data: page } = await useAsyncData(`blog-${locale.value}-${slug}`, () =>
queryCollection(collection).path(path).first()
+1 -1
View File
@@ -12,7 +12,7 @@ export default defineContentConfig({
collections: {
blog_fr: defineCollection({
type: 'page',
source: { include: 'fr/blog/**/*.md', prefix: '/blog' },
source: { include: 'fr/blog/**/*.md', prefix: '/fr/blog' },
schema: blogSchema,
}),
blog_en: defineCollection({
+1 -1
View File
@@ -34,7 +34,7 @@ export default defineNuxtConfig({
name: "Killian' DAL-CIN - Developpeur Full Stack"
},
i18n: {
strategy: 'prefix_except_default',
strategy: 'prefix',
defaultLocale: 'fr',
baseUrl: 'https://killiandalcin.fr',
locales: [