mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
refactor: move schema to config file
This commit is contained in:
+14
-3
@@ -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 };
|
||||||
|
|||||||
Reference in New Issue
Block a user