content collections for badges and projects
This commit is contained in:
parent
b09fe1b8bf
commit
9e72a806be
28 changed files with 131 additions and 61 deletions
30
src/content/config.ts
Normal file
30
src/content/config.ts
Normal 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
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue