classe et espece

This commit is contained in:
2026-02-15 22:58:55 +04:00
parent 2e3b1d7199
commit b173f63088
28 changed files with 487 additions and 2 deletions

44
src/content/config.ts Normal file
View File

@@ -0,0 +1,44 @@
import { defineCollection, z } from "astro:content";
import { glob } from "astro/loaders";
// Petit helper pour éviter la répétition du loader
const obsidianLoader = (path: string) =>
glob({
pattern: "**/[^_]*.{md,mdx}",
base: `./src/content/${path}`,
});
const journal = defineCollection({
loader: obsidianLoader("journal"),
schema: z
.object({
title: z.string(),
// On rend la date plus flexible car Obsidian peut parfois envoyer des strings
publishDate: z.coerce.date(),
tags: z.array(z.string()).default([]),
author: z.string().default("Artisan"),
})
.passthrough(),
});
const classes = defineCollection({
loader: obsidianLoader("classes"),
schema: z
.object({
title: z.string(),
description: z.string(),
})
.passthrough(),
});
const especes = defineCollection({
loader: obsidianLoader("especes"),
schema: z
.object({
title: z.string(),
description: z.string(),
})
.passthrough(),
});
export const collections = { journal, classes, especes };