Files
frontpage/src/content.config.ts
Daniel Kluge ac9ab52d63
All checks were successful
Deploy Astro / Build and Deploy (push) Successful in 49s
Use repository link for projects
2026-03-22 21:54:49 +01:00

48 lines
1.2 KiB
TypeScript

import { z, defineCollection, reference } from 'astro:content';
import { glob, file } from 'astro/loaders';
const blogCollection = defineCollection({
loader: glob({ pattern: "**/*.(md|mdx)", base: "./src/content/blog" }),
schema: z.object({
title: z.string(),
summary: z.string(),
pubDate: z.date(),
}),
});
const portfolioCollection = defineCollection({
loader: glob({ pattern: "**/*.(md|mdx)", base: "./src/content/portfolio" }),
schema: z.object({
title: z.string(),
summary: z.string(),
tags: z.array(z.string()).optional(),
pubDate: z.date(),
repository: z.url().regex(/git/).optional(),
}),
});
const bookChapters = defineCollection({
loader: file("./src/content/book/chapters.json"),
schema: z.object({
name: z.string(),
order: z.number(),
subtitle: z.string(),
})
});
const bookCollection = defineCollection({
loader: glob({ pattern: "**/*.(md|mdx)", base: "./src/content/book" }),
schema: z.object({
chapter: reference("bookChapters"),
title: z.string(),
summary: z.string().optional(),
part: z.number(),
}),
});
export const collections = {
blog: blogCollection,
portfolio: portfolioCollection,
book: bookCollection,
};