feat: more tolerable tags options for posts

This commit is contained in:
草师傅 2025-08-26 21:44:43 +08:00
parent b91b03adec
commit e96c7d89db
Signed by: gb
GPG key ID: 43330A030E2D6478

View file

@ -9,7 +9,7 @@ export const posts = ({image}) => z.object({
date: z.coerce.date(),
updated: z.coerce.date().optional(),
categories: z.union([z.array(z.string()), z.string()]).transform(val => Array.isArray(val) ? val : [val]).default(['uncategorized']),
tags: z.array(z.string()).optional(),
tags: z.union([z.array(z.string()), z.string()]).transform(val => Array.isArray(val) ? val : [val]).optional(),
cover: image().optional(),
author: z.union([z.array(reference('authors')), reference('authors')]).optional(),
});