19 lines
553 B
TypeScript
19 lines
553 B
TypeScript
// 1. Import utilities from `astro:content`
|
|
import { defineCollection, z } from "astro:content";
|
|
|
|
// 2. Import loader(s)
|
|
import { glob, file } from "astro/loaders";
|
|
|
|
// 3. Define your collection(s)
|
|
const notes = defineCollection({
|
|
loader: glob({ pattern: "**/*.md", base: "./src/content/notes" }),
|
|
schema: z.object({
|
|
slug: z.string(),
|
|
title: z.string(),
|
|
createdAt: z.coerce.date(),
|
|
updatedAt: z.coerce.date(),
|
|
}),
|
|
});
|
|
|
|
// 4. Export a single `collections` object to register your collection(s)
|
|
export const collections = { notes };
|