From b420e688ca3a197a7e4ea2591193fd09da817ec7 Mon Sep 17 00:00:00 2001 From: satnaing Date: Sat, 28 Jan 2023 00:38:05 +0630 Subject: [PATCH] feat: define blog schema and add blog collection --- src/content/{schemas.ts => _schemas.ts} | 4 ++-- src/content/config.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/content/{schemas.ts => _schemas.ts} (76%) diff --git a/src/content/schemas.ts b/src/content/_schemas.ts similarity index 76% rename from src/content/schemas.ts rename to src/content/_schemas.ts index 9ea6915..8786ebf 100644 --- a/src/content/schemas.ts +++ b/src/content/_schemas.ts @@ -2,9 +2,9 @@ import { z } from "astro:content"; export const blogSchema = z.object({ author: z.string(), - publishDatetime: z.string(), // z.string().datetime() only available in Zod v3.20.2 + pubDatetime: z.date(), // z.string().datetime() only available in Zod v3.20.2 title: z.string(), - slug: z.string().optional(), + postSlug: z.string().optional(), featured: z.boolean(), draft: z.boolean(), tags: z.array(z.string()), diff --git a/src/content/config.ts b/src/content/config.ts index d685fcd..525824b 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -1,5 +1,5 @@ import { defineCollection } from "astro:content"; -import { blogSchema } from "./schemas"; +import { blogSchema } from "./_schemas"; const blogCollection = defineCollection({ schema: blogSchema,