-
-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move schema to config file
- Loading branch information
1 parent
1cc51c0
commit 817e67a
Showing
1 changed file
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |