Structured data input, which stores data in a field as YAML.
The structure field makes it possible to add multiple complex entries to a field, which will be stored as YAML. A typical use case would be a list of addresses or team members.
fields:
addresses:
label: Addresses
type: structure
entry: >
{{street}}<br />
{{zip}} {{city}}
fields:
street:
label: Street
type: text
zip:
label: ZIP
type: text
city:
label: City
type: text
Such a structure will be stored in the content file like this:
addresses:
-
street: Rue de WTF 17
zip: 1112
city: Monaco
-
street: 1212 Broadway
zip: 4321
city: New York
-
street: At the beach
zip: 9999
city: The capitol of the Bahamas
You can define any number of fields and use the same field types listed. The only exception is a structure field nested in a structure field.
You can use the entry
option to define how the entries will be displayed in the list view. The syntax for entry templates is very simple. Double curly brackets define a variable and will be replaced with the appropriate content.
You can set default values for structure fields which will prepopulate the field:
emails:
label: Emails
type: structure
default:
- email: bastian@getkirby.com
- email: sascha@getkirby.com
- email: nico@getkirby.com
fields:
email:
label: Email
type: email