Add support for an optional description on posts

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

View file

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

View file

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