Content schemas
Studio uses Astro’s content collection system with Zod schemas to define the structure of your content. Schemas drive the editing forms, validation rules, and default values automatically — meaning your type definitions become the single source of truth for how content is authored and validated across the platform.
How schemas work
Section titled “How schemas work”Content lives in src/content/{collection}/ as Markdown or MDX files with YAML frontmatter. Each collection has a Zod schema defined in src/content/config.ts that describes the shape of that frontmatter. Studio extracts these schemas at project load time and uses them to generate form fields for both the visual editor and the entry editor.
This means there is no separate CMS configuration to maintain. When you update your Zod schema, Studio automatically reflects those changes in the editing interface — new fields appear, removed fields disappear, and validation rules update instantly.
Viewing schemas
Section titled “Viewing schemas”Navigate to Schema from the Studio sidebar to see an overview of every content collection in your project. The schema view displays:
| Detail | Description |
|---|---|
| Field count | The number of fields defined in the collection’s Zod schema |
| Entry count | How many content entries exist in the collection |
| Data directory path | The file system path where the collection’s content files are stored |
Use the grid and list view toggle in the top-right corner to switch between a card layout and a compact table layout, depending on how many collections your project contains.
Creating a collection
Section titled “Creating a collection”To create a new content collection:
- Click Create Collection from the schema view.
- Enter a collection name. Studio auto-slugs the name to lowercase (for example, “Blog Posts” becomes
blog-posts). - Optionally copy fields from an existing collection to use as a starting point.
- Click Create to confirm.
Studio performs three actions when a collection is created:
- Updates
src/content/config.tswith the new collection definition and its Zod schema - Creates the data directory at
src/content/{collection}/ - Scaffolds an Astro page template so the collection is immediately renderable in your site
Field types
Section titled “Field types”Studio supports the following Zod field types, each mapped to a purpose-built form control:
| Type | Form control | Example use |
|---|---|---|
string | Text input | Page title, author name, description |
number | Number input | Sort order, rating, word count |
boolean | Checkbox | Draft status, featured flag, visibility toggle |
date | Date/time picker | Publish date, last modified, event start |
enum | Dropdown | Category selection, status level, content type |
tags | Tag input (array of strings) | Post tags, keywords, related topics |
image | Media picker | Hero image, thumbnail, author avatar |
array | Dynamic list | Related links, footnotes, changelog entries |
object | Nested field group | SEO metadata, social card settings, author details |
Editing a schema
Section titled “Editing a schema”Open any collection from the schema view to launch the Schema Editor. From here you can:
- Add fields — Choose a field type and configure its name, label, and validation rules.
- Remove fields — Delete fields that are no longer needed. Existing entries retain the data in their frontmatter until the files are updated.
- Reorder fields — Drag fields to change the order they appear in the editing form.
- Change types — Switch a field’s type (for example, from
stringtoenum) and Studio updates the form control accordingly. - Toggle required — Mark fields as required or optional. Required fields show validation errors if left empty.
- Set defaults — Define default values that pre-populate when authors create new entries.
- Define enum options — For
enumfields, specify the list of allowed values that appear in the dropdown.
When you click Save, Studio writes the updated Zod schema back to src/content/config.ts and regenerates the editing forms for that collection.
Example schema
Section titled “Example schema”A typical src/content/config.ts file looks like this:
import { defineCollection, z } from 'astro:content';
const blog = defineCollection({ schema: z.object({ title: z.string(), date: z.date(), draft: z.boolean().default(true), tags: z.array(z.string()).default([]), image: z.string().optional(), category: z.enum(['tutorial', 'news', 'opinion']), })});
export const collections = { blog };This schema produces a form with six fields: a text input for the title, a date picker for the date, a checkbox for draft status (defaulting to checked), a tag input for tags, a media picker for the optional image, and a dropdown for category with three choices.
Next steps
Section titled “Next steps”- Visual editor — Learn how to edit content inline with live preview and click-to-edit annotations
- Content management — Create, organise, and manage entries across your content collections