35 lines
993 B
TypeScript
35 lines
993 B
TypeScript
import { glob } from 'astro/loaders'
|
|
import { defineCollection } from 'astro:content'
|
|
import { z } from 'zod'
|
|
|
|
const blog = defineCollection({
|
|
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
date: z.coerce.date(),
|
|
image: image().optional(),
|
|
tags: z.array(z.string()).optional(),
|
|
authors: z.array(z.string()).optional(),
|
|
draft: z.boolean().optional(),
|
|
}),
|
|
})
|
|
|
|
const projects = defineCollection({
|
|
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/projects' }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
name: z.string(),
|
|
description: z.string(),
|
|
tags: z.array(z.string()),
|
|
image: image(),
|
|
link: z.url().optional(),
|
|
order: z.number().optional(),
|
|
startDate: z.coerce.date().optional(),
|
|
endDate: z.coerce.date().optional(),
|
|
}),
|
|
})
|
|
|
|
export const collections = { blog, projects }
|