Skip to content

Astro Content Collections

Add these fields to your posts collection in src/content.config.ts:

import { defineCollection, z } from 'astro:content';
const posts = defineCollection({
schema: z.object({
title: z.string(),
date: z.coerce.date(),
author: z.string().default(''),
categories: z.array(z.string()).default([]),
tags: z.array(z.string()).default([]),
feature_image: z.string().optional(),
draft: z.boolean().default(false),
}),
});
export const collections = { posts };

scribe writes categories as a YAML array even when only one is selected:

categories:
- review

Using z.string() instead of z.array(z.string()) will cause build failures.