Files
nicco.io/src/content.config.ts
2026-06-28 19:09:30 +02:00

26 lines
728 B
TypeScript

import { defineCollection } from 'astro:content'
import { z } from 'astro/zod'
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().optional(),
date: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
coverImage: image().optional(),
tags: z.string().array().default([]),
}),
})
const page = defineCollection({
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/page' }),
schema: z.object({
title: z.string(),
date: z.coerce.date(),
}),
})
export const collections = { blog, page }