mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-04-01 17:50:13 +00:00
34 lines
No EOL
998 B
TypeScript
34 lines
No EOL
998 B
TypeScript
// Import the glob loader
|
|
import { glob } from "astro/loaders";
|
|
// Import utilities from `astro:content`
|
|
import { defineCollection } from "astro:content";
|
|
// Import Zod
|
|
import { z } from "astro/zod";
|
|
// Define a `loader` and `schema` for each collection
|
|
const blog = defineCollection({
|
|
loader: glob({ pattern: '**/[^_]*.md', base: "./src/blog" }),
|
|
schema: z.object({
|
|
title: z.string(),
|
|
pubDate: z.date(),
|
|
description: z.string(),
|
|
author: z.string(),
|
|
image: z.object({
|
|
url: z.string(),
|
|
alt: z.string()
|
|
}),
|
|
tags: z.array(z.string()),
|
|
})
|
|
});
|
|
|
|
const friends = defineCollection({
|
|
loader: glob({ pattern: '**/[^_]*.md', base: "./src/friends" }),
|
|
schema: z.object({
|
|
name: z.string(),
|
|
description: z.string(),
|
|
url: z.string(),
|
|
avatar: z.string()
|
|
})
|
|
});
|
|
|
|
// Export a single `collections` object to register your collection(s)
|
|
export const collections = { blog, friends }; |