List
Configure repeated fields and top-level arrays.
list is used in two places:
- on fields, to repeat a field as an array
- on
type: filecontent entries, to store the whole file as a top-level array
Field lists
Set list: true to repeat a field.
- name: tags
type: string
list: true
You can also use the object form:
| Key | Description |
|---|---|
min |
Minimum number of items. |
max |
Maximum number of items. |
collapsible |
Make object or block items collapsible. Values: true, false, or an object. |
collapsible
Use collapsible on object or block lists to collapse each item in the editor.
You can use a boolean:
- name: sections
type: object
list:
collapsible: true
fields:
- name: title
type: string
Or the object form:
| Key | Description |
|---|---|
collapsed |
Values: true, false. Whether items start collapsed by default. |
summary |
Summary text shown for each collapsed item. |
summary supports:
| Token | Description |
|---|---|
{index} |
1-based list item index. |
{fields.<name>} |
Field value from the current object item (e.g. {fields.title}). |
{<name>} |
Shorthand for {fields.<name>} (e.g. {title}). |
Top-level arrays in files
For type: file, set list: true when the file content itself is an array.
content:
- name: authors
label: Authors
type: file
path: data/authors.json
format: json
list: true
fields:
- name: name
type: string
- name: email
type: string
- name: avatar
type: image
For content entries, the documented form is list: true.
Example
- name: sections
type: object
list:
min: 1
max: 6
collapsible:
collapsed: true
summary: "{title} ({index})"
fields:
- name: title
type: string
- name: body
type: rich-text