website/src/content/config.ts

30 lines
No EOL
790 B
TypeScript

import { z, defineCollection } from "astro:content";
// some of these schemas are a bit Weird but,
// i find it easier to have it in one array instead of several files
const projectsCollection = defineCollection({
type: "data",
schema: z.array(z.object({
name: z.string(),
description: z.string(),
date: z.date(),
dateVisual: z.string().optional(),
links: z.string().array()
}))
});
const badgesCollection = defineCollection({
type: "data",
schema: ({ image }) => z.array(z.object({
path: image().or(z.string()),
alt: z.string(),
href: z.string().optional(),
title: z.string().optional()
}))
});
export const collections = {
projects: projectsCollection,
badges: badgesCollection
};