技术样例 · Astro 内容层 API 小记
/ 1 min read
Table of Contents
这是一篇放在 技术 分区的样例博客,主要用于验证博客卡片的标题、标签和时间排版。正式内容会在后续博文里补上。
代码示例
// src/content.config.ts(节选)const post = defineCollection({ loader: glob({ base: "./src/content/post", pattern: "**/*.{md,mdx}" }), schema: ({ image: _image }) => z.object({ title: z.string().max(80), description: z.string(), category: z.enum(["tech", "misc"]).default("tech"), }),});