Drive archive posts from content

This commit is contained in:
Loyyd 2026-06-11 14:19:57 +02:00
parent d74495ddef
commit b4025aecaf
4 changed files with 276 additions and 2 deletions

24
src/content.config.ts Normal file
View file

@ -0,0 +1,24 @@
import { defineCollection } from "astro:content";
import { glob } from "astro/loaders";
import { z } from "astro/zod";
const archive = defineCollection({
loader: glob({
base: "./content",
pattern: ["blog/**/*.md", "speeches/**/*.md"],
generateId: ({ entry }) => entry.replace(/\.md$/, ""),
}),
schema: z.object({
title: z.string().optional(),
type: z.enum(["blog", "speech"]).optional(),
published: z.string().optional(),
updated: z.string().optional(),
source: z.string().optional(),
speechYear: z.string().optional(),
speechCollection: z.string().optional(),
categories: z.array(z.string()).optional().default([]),
tags: z.array(z.string()).optional().default([]),
}),
});
export const collections = { archive };