generated from template/astro-simple-template
Initial commit
This commit is contained in:
24
src/content.config.ts
Normal file
24
src/content.config.ts
Normal 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 };
|
||||
Reference in New Issue
Block a user