Partial

Import fields from another fieldset.


Usage

The Partial fieldset technically isn’t a Fieldset. It’s a mechanism that allows you to import the fields from another Fieldset. This is handy when you want to reuse common fields throughout a number of other fieldsets, like a pile of metadata fields.

You cannot use conditional logic on Fieldset Partials. They are imported and resolved before the logic is parsed. You can, however, add conditions on the contained fields themselves.

Example

The blog_post.yaml fieldset, which is what you’ll be associating to posts using fieldset: blog_post:

fields:
  title:
    type: title
  seo: # this key can be anything as long as it's unique.
    type: partial
    fieldset: seo
  content:
    type: markdown

The seo.yaml field, which we’ll reference as a partial from within blog_post.yaml above.

fields:
  meta_description:
    type: text
  meta_keywords:
    type: text

When using the blog_post fieldset on the publish page, the fields from the partial will be brought inline and rendered in the following order, as if they were all part of a single fieldset:

  • title
  • meta_description
  • meta_keywords
  • content

Important Caveat: The field name of the partial does not matter as long as it’s unique. It will be replaced by the fields in the partial without any reference to the original name.


Settings

This fieldtype supports the following settings in addition to the defaults.

fieldset

string

Name of the fieldset to include.

Last modified on February 20, 2018