martials.no/src/content/config.ts
Martin Berg Alstad 941a93f8a5
All checks were successful
Build and deploy website / build (push) Successful in 1m56s
Updated to Astro v5 beta.
Created a new component for a collapsable list

Implemented some of the new features.
- astro:env
- New astro content layer

Signed-off-by: Martin Berg Alstad <git@martials.no>
2024-10-20 12:05:32 +02:00

32 lines
841 B
TypeScript

import { defineCollection, z } from "astro:content"
import { glob } from "astro/loaders"
const projectCollection = defineCollection({
loader: glob({ pattern: "**\/*.mdx", base: "./src/content/projects" }),
schema: ({ image }) =>
z.object({
title: z.string(),
description: z.string(),
heroImage: image(),
heroImageAlt: z.string(),
tags: z.array(z.string()),
source: z.string(),
createdAt: z.string(),
updatedAt: z.string()
})
})
const hardwareCollection = defineCollection({
loader: glob({ pattern: "**\/*.yaml", base: "./src/content/hardware" }),
schema: z.object({
title: z.string(),
accessories: z.optional(z.array(z.string())),
hardware: z.array(z.string())
})
})
export const collections = {
projects: projectCollection,
hardware: hardwareCollection
}