Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame^] | 1 | import { defineCollection, z } from 'astro:content'; |
2 | |||||
3 | const blog = defineCollection({ | ||||
4 | type: 'content', | ||||
5 | // Type-check frontmatter using a schema | ||||
6 | schema: z.object({ | ||||
7 | title: z.string(), | ||||
8 | description: z.string(), | ||||
9 | // Transform string to Date object | ||||
10 | pubDate: z.coerce.date(), | ||||
11 | updatedDate: z.coerce.date().optional(), | ||||
12 | heroImage: z.string().optional(), | ||||
13 | }), | ||||
14 | }); | ||||
15 | |||||
16 | export const collections = { blog }; |