24 lines
773 B
TypeScript
24 lines
773 B
TypeScript
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 };
|