Skip to content

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.

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.

Navigate to Schema from the Studio sidebar to see an overview of every content collection in your project. The schema view displays:

DetailDescription
Field countThe number of fields defined in the collection’s Zod schema
Entry countHow many content entries exist in the collection
Data directory pathThe 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.

To create a new content collection:

  1. Click Create Collection from the schema view.
  2. Enter a collection name. Studio auto-slugs the name to lowercase (for example, “Blog Posts” becomes blog-posts).
  3. Optionally copy fields from an existing collection to use as a starting point.
  4. Click Create to confirm.

Studio performs three actions when a collection is created:

  • Updates src/content/config.ts with 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

Studio supports the following Zod field types, each mapped to a purpose-built form control:

TypeForm controlExample use
stringText inputPage title, author name, description
numberNumber inputSort order, rating, word count
booleanCheckboxDraft status, featured flag, visibility toggle
dateDate/time pickerPublish date, last modified, event start
enumDropdownCategory selection, status level, content type
tagsTag input (array of strings)Post tags, keywords, related topics
imageMedia pickerHero image, thumbnail, author avatar
arrayDynamic listRelated links, footnotes, changelog entries
objectNested field groupSEO metadata, social card settings, author details

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 string to enum) 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 enum fields, 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.

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.

  • 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