ne pas se reposer sur ces acquis
This commit is contained in:
@@ -1,31 +1,27 @@
|
||||
// 1. Importer les utilitaires de `astro:content`
|
||||
import { z, defineCollection } from 'astro:content';
|
||||
import { defineCollection, z } from 'astro:content';
|
||||
|
||||
// 2. Définir une collection pour le journal d'aventure
|
||||
// Collection pour les articles du journal d'aventure
|
||||
const journalCollection = defineCollection({
|
||||
type: 'content', // 'content' pour les fichiers .md ou .mdx
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
author: z.string(),
|
||||
publishDate: z.date(),
|
||||
image: z.object({
|
||||
src: z.string(),
|
||||
alt: z.string(),
|
||||
}).optional(),
|
||||
}),
|
||||
type: 'content',
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
author: z.string(),
|
||||
publishDate: z.date(),
|
||||
tags: z.array(z.string()).optional(), // Ajout des balises (optionnel)
|
||||
}),
|
||||
});
|
||||
|
||||
// 3. Définir une collection pour les logs de construction
|
||||
// Collection pour les logs de construction
|
||||
const logsCollection = defineCollection({
|
||||
type: 'content',
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
publishDate: z.date(),
|
||||
}),
|
||||
type: 'content',
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
publishDate: z.date(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
// 4. Exporter les collections pour les enregistrer
|
||||
export const collections = {
|
||||
'journal': journalCollection,
|
||||
'logs': logsCollection,
|
||||
};
|
||||
journal: journalCollection,
|
||||
logs: logsCollection,
|
||||
};
|
||||
Reference in New Issue
Block a user