Controlling Data Bindings

Control how CloudCannon adds automatic data bindings to your components

With components on the page, Bookshop will create CloudCannon's Visual Data Bindings automatically if the data for that component can be found in your page's front matter.

By default, Bookshop will add bindings for any components on the page, but will not add bindings for shared helper files. This prevents Bookshop from rendering data bindings around our shared page helper, so that the components within are immediately accessible.

This behavior can be customized by including a flag in the component's data. Bookshop will look for any of the following keys:

  • data_binding
  • dataBinding
  • _data_binding
  • _dataBinding

For example:

<!-- Components -->
{% bookshop 'item' props: props %} 
{% bookshop 'item' data_binding: false props: props %} 

<!-- Includes -->
{% bookshop_include 'page' props: props %} 
{% bookshop_include 'page' data_binding: true props: props %} 

By default, a component will be given a data binding if possible.

This component will not be given a data binding.

By default, bookshop_include helpers will not be given a data binding.

This helper will be given a data binding.

This flag only applies to the tagged component directly and doesn't cascade down. Any subcomponents will follow the standard rules, or may also specify their own Data Binding flag.

Open in a new tab