Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 1 | import { defineCollection, z } from 'astro:content'; |
| 2 | |
Samuel Shuert | 21af95a | 2024-04-30 17:49:11 -0400 | [diff] [blame^] | 3 | const post = defineCollection({ |
Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 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(), |
Samuel Shuert | 21af95a | 2024-04-30 17:49:11 -0400 | [diff] [blame^] | 12 | pinned: z.coerce.boolean().optional() |
Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame] | 13 | }), |
| 14 | }); |
| 15 | |
Samuel Shuert | 21af95a | 2024-04-30 17:49:11 -0400 | [diff] [blame^] | 16 | export const collections = { post }; |