Define the editor schema for collections and files.

fields defines the editor schema.

Keys

These keys apply to all field types unless noted otherwise.

Key Description
name * Field key used in stored data.
label UI label for the field. Set false to hide it.
type * Field type. Use type or component.
component Reuse a field definition from components. Use component or type.
required Marks the field as required.
pattern Regex validation for supported field types.
hidden Hides the field from the editor.
readonly Shows the field value but prevents editing it. Inherited by nested object, block, and list fields.
description Helper text shown below the field.
options Field-specific options. See each field page for details.

*: Required

pattern

pattern validates a field value against a regex.

Currently, it is supported by:

  • string
  • text

You can use either a string:

pattern: "^[a-z0-9-]+$"

Or an object with a custom message:

pattern:
  regex: "^[A-Z]{3}-\\d{4}$"
  message: "Use format ABC-1234"

component

Use component to reference a reusable field definition from components.

A field must use exactly one of:

  • type
  • component

Example:

components:
  seo:
    type: object
    label: SEO
    fields:
      - name: title
        type: string
      - name: description
        type: text

content:
  - name: pages
    type: collection
    path: content/pages
    fields:
      - name: seo
        component: seo
        label: Meta

body is a special key

For frontmatter formats, body maps to the file content below the frontmatter.

All other fields stay in frontmatter.

fields:
  - name: title
    type: string
  - name: body
    type: rich-text

Field types

Type Description
block Multiple object shapes in one list.
boolean True/false toggle.
code Code editor with syntax highlighting.
date Date or date-time input.
file File picker or uploader.
image Image picker or uploader.
number Numeric input.
object Nested group of fields.
reference Link to another collection.
rich-text Rich text editor.
select Fixed local options.
string Single-line text input.
text Multi-line plain text input.
uuid UUID v4 field.

Examples

Frontmatter with body content

fields:
  - name: title
    type: string
  - name: published
    type: boolean
  - name: body
    type: rich-text

Nested object field

fields:
  - name: author
    type: object
    fields:
      - name: name
        type: string
      - name: email
        type: string

String field with pattern

fields:
  - name: slug
    type: string
    required: true
    pattern: "^[a-z0-9-]+$"
    options:
      minlength: 3
      maxlength: 80

Text field with custom pattern message

fields:
  - name: summary
    type: text
    required: true
    pattern:
      regex: "^(?s).{20,500}$"
      message: "Summary must be between 20 and 500 characters"
    options:
      minlength: 20
      maxlength: 500