diff options
Diffstat (limited to 'src/content/config.ts')
| -rw-r--r-- | src/content/config.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/content/config.ts b/src/content/config.ts index b4e86c9..e2c62ca 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -18,4 +18,23 @@ const blog = defineCollection({ }), }); -export const collections = { blog }; +const micro = defineCollection({ + // Type-check frontmatter using a schema + schema: z.object({ + title: z.string(), + description: z.string(), + // Transform string to Date object + pubDate: z + .string() + .or(z.date()) + .transform((val) => new Date(val)), + updatedDate: z + .string() + .optional() + .transform((str) => (str ? new Date(str) : undefined)), + heroImage: z.string().optional(), + }), +}); + + +export const collections = { blog, micro }; |
