refactor: move schema to config file

This commit is contained in:
tanishqmanuja
2023-09-20 14:54:32 +05:30
committed by Sat Naing
parent 1cc51c00a7
commit 817e67ac65
+14 -3
View File
@@ -1,8 +1,19 @@
import { defineCollection } from "astro:content"; import { defineCollection, z } from "astro:content";
import { blogSchema } from "./_schemas";
const blog = defineCollection({ 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 }; export const collections = { blog };