83197899c8
- Define blog_fr collection: fr/blog/**/*.md → prefix /blog (FR default locale) - Define blog_en collection: en/blog/**/*.md → prefix /en/blog (EN prefixed) - Add Zod schema: title, description, date (required) + tags, image (optional)
25 lines
611 B
TypeScript
25 lines
611 B
TypeScript
import { defineContentConfig, defineCollection, z } from '@nuxt/content'
|
|
|
|
const blogSchema = z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
date: z.string(),
|
|
tags: z.array(z.string()).optional(),
|
|
image: z.string().optional(),
|
|
})
|
|
|
|
export default defineContentConfig({
|
|
collections: {
|
|
blog_fr: defineCollection({
|
|
type: 'page',
|
|
source: { include: 'fr/blog/**/*.md', prefix: '/blog' },
|
|
schema: blogSchema,
|
|
}),
|
|
blog_en: defineCollection({
|
|
type: 'page',
|
|
source: { include: 'en/blog/**/*.md', prefix: '/en/blog' },
|
|
schema: blogSchema,
|
|
}),
|
|
},
|
|
})
|