polsevev.dev/src/content/config.ts

34 lines
757 B
TypeScript

import { defineCollection, z } from 'astro:content';
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()
})
})
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(),
}),
});
export const collections = { blog, homelab, servers };