website-astro/src/content/config.ts

22 lines
500 B
TypeScript
Raw Normal View History

2022-12-22 10:18:44 +00:00
import { z, defineCollection } from "astro:content";
const articles = defineCollection({
schema: {
title: z.string(),
subtitle: z.string(),
lang: z.enum(["fr", "en"]),
2022-12-26 22:15:27 +00:00
slug: z.string(),
2022-12-22 10:18:44 +00:00
tags: z.array(z.string()), // An array of strings
// Parse pubDate as a browser-standard `Date` object
pubDate: z
.string()
.transform((str) => new Date(str))
.optional(),
},
});
export const collections = {
// Don't forget 'quotes' for collection names containing dashes
articles,
};