Add support for an optional description on posts

This commit is contained in:
JasterV 2025-06-05 20:56:39 +02:00
parent 24fc48b367
commit b986ffb4f1
2 changed files with 2 additions and 0 deletions

View file

@ -7,6 +7,7 @@ const blog = defineCollection({
schema: ({ image }) => schema: ({ image }) =>
z.object({ z.object({
title: z.string(), title: z.string(),
description: z.string().optional(),
pubDate: z.coerce.date(), pubDate: z.coerce.date(),
image: image(), image: image(),
}), }),

View file

@ -26,6 +26,7 @@ const sortedPosts = posts.sort(
{post.data.title} {post.data.title}
</a> </a>
</h2> </h2>
{post.data.description && <p>{post.data.description}</p>}
</article> </article>
)) ))
} }