summaryrefslogtreecommitdiff
path: root/examples/starlog/src/content.config.ts
blob: 5cc4c697f7e4ef9b5b10efb55d199cd953090b5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { defineCollection, z } from 'astro:content';

const releases = defineCollection({
	// Type-check frontmatter using a schema
	schema: ({ image }) =>
		z.object({
			title: z.string(),
			description: z.string(),
			versionNumber: z.string(),
			image: z.object({
				src: image(),
				alt: z.string(),
			}),
			// Transform string to Date object
			date: z.date({ coerce: true }),
		}),
});

export const collections = { releases };