Skip to content

Commit

Permalink
feat: define blog schema and add blog collection
Browse files Browse the repository at this point in the history
  • Loading branch information
satnaing committed Jan 27, 2023
1 parent 041f541 commit b420e68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/content/schemas.ts → src/content/_schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
2 changes: 1 addition & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineCollection } from "astro:content";
import { blogSchema } from "./schemas";
import { blogSchema } from "./_schemas";

const blogCollection = defineCollection({
schema: blogSchema,
Expand Down

0 comments on commit b420e68

Please sign in to comment.