Changing inputs in the configuration cascade

CloudCannon offers different configuration options for each input and editor. Use this to improve the editing experience for your sites. Configuration can be set from a number of sources, from lowest priority to highest:

  1. Site configuration
  2. Collection configuration
  3. Front matter
  4. Containing structure

Inside each of these sources, the configuration groups are _inputs, _editables, _select_data and _structures.

Configuration for inputs and editables is set with properties on the key matching the same name. (e.g. _inputs.image matches the image front matter input).

Site configuration - configure something everywhere on your site. For example:

_config.yml
_inputs:
  image_path:
    type: image
    comment: Helpful message here
    options:
      width: 90
      height: 120
_select_data:
  colors:
    - Red
    - Blue

Collection configuration - configure inputs for all files within a collection. For example:

_config.yml
cloudcannon:
  collections:
    pages:
      _inputs:
        image_path:
          type: image
          comment: Helpful message here
          options:
            width: 90
            height: 120
      _select_data:
        colors:
          - Red
          - Blue

Front matter - configure inputs inside a single file. For example:

Configuration
image_path: /uploads/me.png
_inputs:
  image_path:
    type: image
    comment: Helpful message here
    options:
      width: 90
      height: 120
_select_data:
  colors:
    - Red
    - Blue

Containing structure - configure inputs inside an array structure. For example:

Configuration
_structures:
  gallery:
    values:
      - label: Image
        icon: image
        _inputs:
          image:
            type: image
            options:
              width: 50
              height: 50
          caption:
            comment: Applies inside this structure
        _select_data:
          colors:
            - Red
            - Blue
        value:
          image: /uploads/placeholder.png
          caption:
          color:
Note

For nested structured data, you can nest _structures alongside the other configuration groups inside a structure definition.

Cascading

The configuration cascade works by finding the most specific configuration set for any given key (e.g. _structures defined in front matter are prioritized over global configuration).

Once a _editables, _select_data and _structures configurations is found in the cascade, there’s no reason to keep looking. This means the most specific value is used in place of any less specific values.

The _inputs configuration works differently, each entry is merged down the cascade. This allows you to define a comment globally, then a different label for inputs in a collection without redefining the comment. You can stop the cascade at any given point by setting cascade to false.

To demonstrate, the comment would not display for the input when editing the front matter:

Global configuration
_inputs:
  text_field:
    comment: Put text in here.
Front matter
text_field:
_inputs:
  text_field:
    cascade: false
Was this article helpful? or Suggest an improvement >