Fields overview
Fields turn the keys in your files into form inputs. Each field has a name, the key in the file, and a type:
fields:
- name: title
type: string
required: true
- name: tags
type: string
list: trueField types
Self-hosted instances can add their own types with plugins.
Keys for every field
The body field
In Markdown and other front matter files, a field named body holds the content below the front matter, not a front matter key. Any field type works, but rich-text is the usual choice:
fields:
- name: title
type: string
- name: body
type: rich-textLists
list: true turns any field into a list editors can add to, remove from and reorder:
- name: tags
type: string
list: trueA saved value in YAML or Markdown front matter might look like:
tags: [news, launch]Use an object to set limits and collapse long lists:
- name: faq
type: object
list:
min: 1
max: 10
collapsible:
collapsed: true
summary: '{index}. {question}'
fields:
- name: question
type: string
- name: answer
type: rich-textValidation
required, list.min and list.max, and type options such as minlength are checked before saving. For string and text fields, add pattern:
- name: slug
type: string
pattern: '^[a-z0-9-]+$'Add a message to explain the rule:
- name: sku
type: string
pattern:
regex: '^[A-Z]{3}-\d{4}$'
message: Use the format ABC-1234Patterns use JavaScript regular expression syntax and must match the whole value you intend: anchor them with ^ and $.