mirror of
https://github.com/JuLi0n21/homepage.git
synced 2026-04-19 15:20:05 +00:00
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { defineCollection, z } from "astro:content";
|
|
import { glob } from "astro/loaders";
|
|
|
|
const personal = defineCollection({
|
|
// Load Markdown and MDX files in the `src/content/blog/` directory.
|
|
loader: glob({
|
|
base: "./src/content/blog/personal",
|
|
pattern: "**/*.{md,mdx}",
|
|
}),
|
|
// Type-check frontmatter using a schema
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
// Transform string to Date object
|
|
pubDate: z.coerce.date(),
|
|
gitLink: z.string().optional(),
|
|
heroImage: image().optional(),
|
|
}),
|
|
});
|
|
|
|
const uni = defineCollection({
|
|
// Load Markdown and MDX files in the `src/content/blog/` directory.
|
|
loader: glob({
|
|
base: "./src/content/blog/university",
|
|
pattern: "**/*.{md,mdx}",
|
|
}),
|
|
// Type-check frontmatter using a schema
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
// Transform string to Date object
|
|
pubDate: z.coerce.date(),
|
|
gitLink: z.string().optional(),
|
|
heroImage: image().optional(),
|
|
}),
|
|
});
|
|
|
|
export const collections = { personal, uni };
|