A block holds one of several field groups, and the editor chooses which. With list: true it becomes a page builder: a list of sections that can each be a different kind.

Add this field under fields in .pages.yml:

- name: sections
  type: block
  list: true
  blocks:
    - name: hero
      label: Hero
      fields:
        - name: heading
          type: string
        - name: image
          type: image
    - name: text
      label: Text
      fields:
        - name: body
          type: rich-text

Each item stores its fields plus the block's name under _block:

sections:
  - _block: hero
    heading: Welcome
    image: /uploads/hero.jpg
  - _block: text
    body: Hello world

If the site expects a different key, such as type, set blockKey:

- name: sections
  type: block
  list: true
  blockKey: type
  blocks: …

In an Astro content schema, a block list maps well to a discriminated union on that key, such as z.discriminatedUnion('type', [...]).

Keys

blocks and blockKey go directly on the field, not under options.

Key Description
blocks Required. The available blocks. Each has a name, an optional label, and either fields or a component.
blockKey The key that stores the block's name. Default _block.

A saved item must name one of the configured blocks.

Tips

  • Define blocks as components to share them between collections: - { name: hero, component: hero }.
  • A block's own fields can be lists or objects, such as a list of FAQ items inside an faq block. An entry in blocks itself can't take type, list, required or options.