This commit is contained in:
2026-01-27 22:25:40 +08:00
parent c2f5f504d3
commit 98f21d8aaa
44 changed files with 2 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
// @ts-ignore
import { defineCollection, z } from 'astro:content';
import { glob, file } from 'astro/loaders'; // 不适用于旧版 API
const docs = defineCollection({
loader: glob({ pattern: '**/[^_]*.md', base: './src/data/docs' }),
schema: z.object({
title: z.string().optional(),
description: z.string().optional(),
tags: z.array(z.string()).optional(),
// pubDate: z.coerce.date(),
createdAt: z.coerce.date().optional(),
updatedAt: z.coerce.date().optional(),
showMenu: z.boolean().optional().default(true),
/**
* 在侧边栏隐藏该文档
*/
hideInMenu: z.boolean().optional().default(false),
order: z.number().optional().default(0),
}),
});
export const collections = { docs };