Amp-Thread-ID: https://ampcode.com/threads/T-019c7839-0936-729b-aa87-92b35d3d68fe Co-authored-by: Amp <amp@ampcode.com>
27 lines
765 B
TypeScript
27 lines
765 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: z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
date: z.coerce.date(),
|
|
draft: z.boolean().optional(),
|
|
tags: z.array(z.string()).optional(),
|
|
}),
|
|
});
|
|
|
|
const projects = defineCollection({
|
|
loader: glob({ pattern: '**/*.{md,mdx}', base: "./src/content/projects" }),
|
|
schema: z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
date: z.coerce.date(),
|
|
draft: z.boolean().optional(),
|
|
demoURL: z.string().optional(),
|
|
repoURL: z.string().optional(),
|
|
}),
|
|
});
|
|
|
|
export const collections = { blog, projects };
|