polsevev.dev/src/content/config.ts

35 lines
757 B
TypeScript
Raw Normal View History

2024-08-02 20:52:09 +00:00
import { defineCollection, z } from 'astro:content';
2024-08-03 19:19:51 +00:00
const homelab = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
description: z.string(),
// Transform string to Date object
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
})
})
const servers = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
lastUpdated: z.coerce.date()
})
})
2024-08-02 20:52:09 +00:00
const blog = defineCollection({
type: 'content',
// Type-check frontmatter using a schema
schema: z.object({
title: z.string(),
description: z.string(),
// Transform string to Date object
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
}),
});
2024-08-03 19:19:51 +00:00
export const collections = { blog, homelab, servers };