Files
MyBlog-Next/src/content/_schemas.ts
T

16 lines
484 B
TypeScript

import { z } from "astro:content";
export const blogSchema = z.object({
author: z.string().optional(),
pubDatetime: z.date(), // z.string().datetime() only available in Zod v3.20.2
title: z.string(),
postSlug: z.string().optional(),
featured: z.boolean().optional(),
draft: z.boolean().optional(),
tags: z.array(z.string()).default(["others"]),
ogImage: z.string().optional(),
description: z.string(),
});
export type BlogFrontmatter = z.infer<typeof blogSchema>;