feat: define blog schema and add blog collection

This commit is contained in:
satnaing
2023-01-28 00:38:05 +06:30
parent 041f5412f8
commit b420e688ca
2 changed files with 3 additions and 3 deletions
+20
View File
@@ -0,0 +1,20 @@
import { z } from "astro:content";
export const blogSchema = z.object({
author: z.string(),
pubDatetime: z.date(), // z.string().datetime() only available in Zod v3.20.2
title: z.string(),
postSlug: z.string().optional(),
featured: z.boolean(),
draft: z.boolean(),
tags: z.array(z.string()),
ogImage: z
.object({
src: z.string(),
alt: z.string().optional(),
})
.optional(),
description: z.string(),
});
export type BlogFrontmatter = z.infer<typeof blogSchema>;