mirror of
https://github.com/maciejpedzich/maciejpedzi.ch.git
synced 2024-11-12 17:13:02 +01:00
Adjust config to be compatible with the CMS
This commit is contained in:
parent
6f99ef7a57
commit
1cf7ade0ce
@ -1,21 +1,16 @@
|
|||||||
import { defineCollection, z } from 'astro:content';
|
import { defineCollection, z } from 'astro:content';
|
||||||
|
|
||||||
const blog = defineCollection({
|
const blog = defineCollection({
|
||||||
// Type-check frontmatter using a schema
|
schema: z.object({
|
||||||
schema: z.object({
|
title: z.string(),
|
||||||
title: z.string(),
|
description: z.string(),
|
||||||
description: z.string(),
|
draft: z.boolean().optional().default(true),
|
||||||
// Transform string to Date object
|
pubDate: z
|
||||||
pubDate: z
|
.string()
|
||||||
.string()
|
.or(z.date())
|
||||||
.or(z.date())
|
.transform((val) => new Date(val)),
|
||||||
.transform((val) => new Date(val)),
|
categories: z.enum(['Dev Journal', 'Miscellaneous']).array()
|
||||||
updatedDate: z
|
})
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.transform((str) => (str ? new Date(str) : undefined)),
|
|
||||||
heroImage: z.string().optional(),
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const collections = { blog };
|
export const collections = { blog };
|
||||||
|
Loading…
Reference in New Issue
Block a user