From 1cf7ade0cec905143eb8d8b649460383e655ea92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Wed, 26 Apr 2023 10:21:53 +0200 Subject: [PATCH] Adjust config to be compatible with the CMS --- src/content/config.ts | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/content/config.ts b/src/content/config.ts index b4e86c9..80f535d 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -1,21 +1,16 @@ 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 - .string() - .or(z.date()) - .transform((val) => new Date(val)), - updatedDate: z - .string() - .optional() - .transform((str) => (str ? new Date(str) : undefined)), - heroImage: z.string().optional(), - }), + schema: z.object({ + title: z.string(), + description: z.string(), + draft: z.boolean().optional().default(true), + pubDate: z + .string() + .or(z.date()) + .transform((val) => new Date(val)), + categories: z.enum(['Dev Journal', 'Miscellaneous']).array() + }) }); export const collections = { blog };