2024-09-25 22:20:47 +02:00
|
|
|
import { defineCollection, z } from "astro:content"
|
2024-10-20 12:05:32 +02:00
|
|
|
import { glob } from "astro/loaders"
|
2024-09-28 15:33:31 +02:00
|
|
|
|
2024-09-25 22:20:47 +02:00
|
|
|
const projectCollection = defineCollection({
|
2024-10-20 12:05:32 +02:00
|
|
|
loader: glob({ pattern: "**\/*.mdx", base: "./src/content/projects" }),
|
2024-09-25 22:20:47 +02:00
|
|
|
schema: ({ image }) =>
|
|
|
|
z.object({
|
2025-02-27 21:13:01 +01:00
|
|
|
lang: z.union([z.literal("en"), z.literal("nb")]),
|
2024-09-25 22:20:47 +02:00
|
|
|
title: z.string(),
|
|
|
|
description: z.string(),
|
|
|
|
heroImage: image(),
|
|
|
|
heroImageAlt: z.string(),
|
|
|
|
tags: z.array(z.string()),
|
2025-02-27 21:13:01 +01:00
|
|
|
keywords: z.array(z.string()),
|
2025-02-15 19:25:44 +01:00
|
|
|
source: z.string().url(),
|
|
|
|
createdAt: z.string().date(),
|
|
|
|
updatedAt: z.string().date(),
|
2025-02-15 14:59:32 +01:00
|
|
|
}),
|
2024-09-25 22:20:47 +02:00
|
|
|
})
|
2024-09-28 15:33:31 +02:00
|
|
|
|
2025-02-15 13:29:01 +01:00
|
|
|
const usesCollection = defineCollection({
|
|
|
|
loader: glob({ pattern: "**\/*.yaml", base: "./src/content/uses" }),
|
2024-09-28 15:33:31 +02:00
|
|
|
schema: z.object({
|
2024-10-06 14:43:06 +02:00
|
|
|
title: z.string(),
|
2024-09-28 15:33:31 +02:00
|
|
|
accessories: z.optional(z.array(z.string())),
|
2025-02-15 14:59:32 +01:00
|
|
|
hardware: z.array(z.string()),
|
|
|
|
}),
|
2024-09-28 15:33:31 +02:00
|
|
|
})
|
|
|
|
|
2024-09-25 22:20:47 +02:00
|
|
|
export const collections = {
|
|
|
|
projects: projectCollection,
|
2025-02-15 14:59:32 +01:00
|
|
|
uses: usesCollection,
|
2024-09-25 22:20:47 +02:00
|
|
|
}
|