mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
feat: define blog schema and add blog collection
This commit is contained in:
@@ -2,9 +2,9 @@ import { z } from "astro:content";
|
|||||||
|
|
||||||
export const blogSchema = z.object({
|
export const blogSchema = z.object({
|
||||||
author: z.string(),
|
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(),
|
title: z.string(),
|
||||||
slug: z.string().optional(),
|
postSlug: z.string().optional(),
|
||||||
featured: z.boolean(),
|
featured: z.boolean(),
|
||||||
draft: z.boolean(),
|
draft: z.boolean(),
|
||||||
tags: z.array(z.string()),
|
tags: z.array(z.string()),
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { defineCollection } from "astro:content";
|
import { defineCollection } from "astro:content";
|
||||||
import { blogSchema } from "./schemas";
|
import { blogSchema } from "./_schemas";
|
||||||
|
|
||||||
const blogCollection = defineCollection({
|
const blogCollection = defineCollection({
|
||||||
schema: blogSchema,
|
schema: blogSchema,
|
||||||
|
|||||||
Reference in New Issue
Block a user