Skip to content

Commit

Permalink
refactor: move schema to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
tanishqmanuja authored and satnaing committed Sep 25, 2023
1 parent 1cc51c0 commit 817e67a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import { defineCollection } from "astro:content";
import { blogSchema } from "./_schemas";
import { defineCollection, z } from "astro:content";

const blog = defineCollection({
schema: blogSchema,
type: "content",
schema: z.object({
author: z.string().optional(),
pubDatetime: z.date(),
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(),
canonicalURL: z.string().optional(),
}),
});

export const collections = { blog };

0 comments on commit 817e67a

Please sign in to comment.