Open navClose nav

Field Group

Options

https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2018/01/field-group-options.png

  • Label – the human-friendly label shown above the input field in the editor.
  • Name – the key stored in your content’s front matter, used to access it in your templates.
  • Description – a human friendly description of what the field does and/or instructions for your editors.
  • Hidden – hides the field in the editor, but allows developers to set default values or maintain the field for legacy purposes.

Field UI

https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2018/01/field-group-preview.png

Templating

If you have a text field in your template, you can access it in your templates using the field’s name:

Hugo

{{ with .Params.author }}
<div class="author">
  <h2>{{ .name }}</h2>
  <small>{{ .bio }}</small>
  <img src="{{ .image }}" alt="Photo of {{ .name }}">
</div>
{{ end }}

Jekyll

{% if page.author %}
<div class="author">
  <h2>{{ page.author.name }}</h2>
  <small>{{ page.author.bio }}</small>
  <img src="{{ page.author.image }}" alt="Photo of {{ page.author.name }}">
</div>
{% endif %} 

Config Files

You can configure this field in Front Matter Template Config Files as follows:

type: field_group
name: [String]
label: [String]
description: [String]
hidden: [true|false]
fields:
  - [FieldConfig]

Example

type: field_group
name: authors
label: Authors
description: The authors of this post
hidden: false
fields:
- type: text
  name: name
  label: Author's Name
  config:
    required: true
- type: textarea
  name: bio
  label: Author's Bio 
    config:
    required: true

Last updated on December 31, 2017