summaryrefslogtreecommitdiff
path: root/examples/blog/src/content/config.ts
blob: f0419223e7635a128ab624ab49b7abea587d4833 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { defineCollection, z } from 'astro:content';

const blog = defineCollection({
	// Type-check frontmatter using a schema
	schema: z.object({
		title: z.string(),
		description: z.string(),
		// Transform string to Date object
		pubDate: z.coerce.date(),
		updatedDate: z.coerce.date().optional(),
		heroImage: z.string().optional(),
	}),
});

export const collections = { blog };