17 lines
476 B
TypeScript
17 lines
476 B
TypeScript
import { defineCollection } from "astro:content";
|
|
import { glob } from "astro/loaders";
|
|
import { z } from "astro/zod";
|
|
|
|
const posts = defineCollection({
|
|
loader: glob({ base: "./src/content/posts", pattern: "**/*.md" }),
|
|
schema: z.object({
|
|
title: z.string(),
|
|
date: z.coerce.date(),
|
|
excerpt: z.string().default(""),
|
|
slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
|
|
draft: z.boolean().default(false),
|
|
}),
|
|
});
|
|
|
|
export const collections = { posts };
|