Shortcodes

Shortcodes in ScaleCM app are a special syntax that allows you to reference values of fields of an entry that is currently being edited.

The syntax for the shortcodes is as follows: {fields.FIELD_NAME.LOCALE}. fields is a static part and never changes. FIELD_NAME is an id of the field of the content type. You can find the id in the Content model overview inside Contentful. LOCALE, as the name suggest, is the locale code of a locale to which you want to refer (for example en-US).

Shortcodes are useful in many situations. Among other things, you would use them when changing content type id, content type field id, or when migrating between field types (for example between single- and multi-reference fields).

Shortcodes used to set the field value to the value of another field
Example of shortcodes being used in Set field value operation

Shortcodes and reference fields

You can use shortcodes to reference values of referenced entries as well.

{fields.REFERENCE_FIELD_NAME.LOCALE.FIELDS.REFERENCED_ENTRY_FIELD_NAME.LOCALE} shows how you can go deeper in nested content structures. You can use the brackets notation to select a particular entry in a multi-reference/asset field: {fields.MULTIREFERENCE_FIELD_NAME.LOCALE[2].FIELDS.REFERENCED_ENTRY_FIELD_NAME.LOCALE}. Note that the index starts at 0 ([0] selects the first item in the list).

Shortcodes and reference fields in Rich Text

If you use a shortcode to point to a reference/asset field, it will be embedded as a block entry/asset inside Rich Text field. This works with multi-reference/asset fields as well.

Visual shortcode picker (BETA)

To make inserting shortcodes easier, we have added a visual shortcode picker. You can easily access it by clicking on the "Insert shortcode" button shown under every supported field. The shortcode picker is still a work in progress but we hope it already makes it easier to insert shortcodes.