mirror of
https://github.com/sergeyyarkov/astro-directus-example.git
synced 2026-10-11 10:19:04 +03:00
25 lines
540 B
TypeScript
25 lines
540 B
TypeScript
import { z, defineCollection } from 'astro:content';
|
|
|
|
const blogCollection = defineCollection({
|
|
schema: z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
tags: z.array(z.string()),
|
|
image: z.string().optional(),
|
|
draft: z.boolean().optional(),
|
|
pubDate: z
|
|
.string()
|
|
.or(z.date())
|
|
.transform((val) => new Date(val)),
|
|
updDate: z
|
|
.string()
|
|
.or(z.date())
|
|
.transform((val) => new Date(val))
|
|
.optional(),
|
|
}),
|
|
});
|
|
|
|
export const collections = {
|
|
blog: blogCollection,
|
|
};
|