martials.no/src/content/config.ts

32 lines
841 B
TypeScript
Raw Normal View History

2024-09-25 22:20:47 +02:00
import { defineCollection, z } from "astro:content"
import { glob } from "astro/loaders"
2024-09-25 22:20:47 +02:00
const projectCollection = defineCollection({
loader: glob({ pattern: "**\/*.mdx", base: "./src/content/projects" }),
2024-09-25 22:20:47 +02:00
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()
})
2024-09-25 22:20:47 +02:00
})
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())
})
})
2024-09-25 22:20:47 +02:00
export const collections = {
projects: projectCollection,
hardware: hardwareCollection
2024-09-25 22:20:47 +02:00
}