content collections for badges and projects

This commit is contained in:
Reid 2024-09-18 17:13:15 -07:00
parent b09fe1b8bf
commit 9e72a806be
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
28 changed files with 131 additions and 61 deletions

30
src/content/config.ts Normal file
View file

@ -0,0 +1,30 @@
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
};