refactor: use a content collection for blog posts

This commit is contained in:
Oliver Davies 2023-04-09 10:53:25 +01:00
parent 7b97ad3af2
commit 58061a8e59
177 changed files with 1248 additions and 18 deletions

View file

@ -1,5 +1,16 @@
import { defineCollection, z } from 'astro:content';
const blogCollection = defineCollection({
schema: z.object({
date: z.date().or(z.null()),
draft: z.boolean().optional(),
excerpt: z.string().or(z.null()).optional(),
promoted: z.boolean().optional(),
title: z.string(),
tweets: z.boolean().optional(),
}),
});
const talkCollection = defineCollection({
schema: z.object({
description: z.string(),
@ -16,5 +27,6 @@ const talkCollection = defineCollection({
});
export const collections = {
'talk': talkCollection,
blog: blogCollection,
talk: talkCollection,
};