mirror of
https://github.com/anotherhadi/blog.git
synced 2026-05-20 21:42:33 +02:00
294c4e3acd
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
32 lines
811 B
TypeScript
32 lines
811 B
TypeScript
import { defineCollection, z } from "astro:content";
|
|
import { glob } from "astro/loaders";
|
|
|
|
const blog = defineCollection({
|
|
loader: glob({ pattern: "**/*.{md,mdx}", base: "./src/content/blog" }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
image: image(),
|
|
publishDate: z.coerce.date(),
|
|
updatedDate: z.coerce.date().optional(),
|
|
tags: z.array(z.string()).optional(),
|
|
}),
|
|
});
|
|
|
|
const notes = defineCollection({
|
|
loader: glob({ pattern: "**/*.{md,mdx}", base: "./src/content/notes" }),
|
|
schema: z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
category: z.string().optional(),
|
|
tags: z.array(z.string()).default([]),
|
|
publishDate: z.coerce.date(),
|
|
}),
|
|
});
|
|
|
|
export const collections = {
|
|
blog,
|
|
notes,
|
|
};
|