diff options
Diffstat (limited to 'examples/starlog/src/content.config.ts')
-rw-r--r-- | examples/starlog/src/content.config.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/starlog/src/content.config.ts b/examples/starlog/src/content.config.ts new file mode 100644 index 000000000..5cc4c697f --- /dev/null +++ b/examples/starlog/src/content.config.ts @@ -0,0 +1,19 @@ +import { defineCollection, z } from 'astro:content'; + +const releases = defineCollection({ + // Type-check frontmatter using a schema + schema: ({ image }) => + z.object({ + title: z.string(), + description: z.string(), + versionNumber: z.string(), + image: z.object({ + src: image(), + alt: z.string(), + }), + // Transform string to Date object + date: z.date({ coerce: true }), + }), +}); + +export const collections = { releases }; |