Modeling complex structured content often requires a way of managing repeatable sets of fields that are part of an entry. For example, a commerce site selling coffee beans could have an entry for beans, which would also have available roasts and grinds. Rather than creating content types for each variation, you can create a relationship between the content "coffee bean" and all available roasts and grinds with blocks.

Blocks are used to model repeated data within an entry or composition. They expect an array of data that's only shared in relation to something else. In the commerce site example given, you wouldn't present roasts or grind levels independent of the context of coffee beans or reuse that information for other products.

Some other examples of blocks include:

  • Opening hours of a store or restaurant (e.g. Monday 8:00am - 5:00pm)
  • Nutrition information for a recipe (e.g. 5 gram of unsaturated fat)
  • Variants (size, color) of a product (e.g. T-shirt in back, large)

Modeling with blocks requires two steps. The block or blocks must be created as a content type. Then the block can be added to an entry or a component.

The first step in using blocks is to create one.

  1. Navigate to Experience > Content types and select Add content type.
  2. Enter your information in the fields presented as necessary for the block you are trying to create.
  3. Make sure you select the checkbox for Use only for blocks.
  4. Add what field or fields you need for your model. For example, you could create a block called "Size" with a dropdown list field for options with "small," "medium," and "large."
  5. Click Save on the bottom of the dialog to update the content type configuration. To add a new field you can also select Save and add another option in the button dropdown.
  6. After all the content type updates are complete, make sure to save the content type to apply your changes.

Next, you'll add the block to a content structure.

Blocks can be added to content types as fields or to a component as parameters.

Blocks can also be nested to allow for structures where elements are grouped. To continue the e-commerce coffee site example, there could be recipes for different ways to make coffee with different coffee makers. You could use a block to create a step block to grind the beans, and within that a nested step block for the different grinds needed for different brewing methods.

A block containing additional, nested blocks.

Don't nest blocks too deeply

While there are no limits on how deeply you can nest blocks, we recommend to not exceed 2 levels. It will become more difficult to find the right content to edit when you need to drill down through multiple levels of nested blocks.

Loops can be used in blocks if you want to connect the block field to pull in an array of structured data from an data resource. For example, you might want to pull in the product variants of an Product entry from an eternal product information management system (PIM) and connect the properties of the variants to a "Product Variant" block type.

A block containing a loop with product variants

To be able to insert the loop component into a block field you need to enable it in the "Allowed types" settings of the block field or parameter.

Enabling the loop component for a block field