CMS blocks overview

Edit on GitHub

A CMS block is a piece of reusable content that you can add to multiple CMS pages and templates. For example, with the help of a block, you can add banners to the top of a page or add SEO text to the bottom of a page.

CMS block template

A CMS block template is a Twig file that, when applied to a block, defines its design, layout, and functionality.

You can create templates to effectively create similar content. However, as far as CMS block is a multi-purpose entity, you can create templates that let you manage the content of different functionalities in your shop. For example, you can manage emails using CMS blocks.

The CMS feature is shipped with several block templates by default. A developer can create more templates.

CMS block validity period

When creating a block, you can select validity dates. The dates define when the block starts and stops being displayed on the pages it is added to on the Storefront. For example, if you are planning to run a promotion campaign, you can create a banner beforehand and define when it starts and stops being displayed based on the promotion period.

CMS block store relation

If you have an international store, you can define which stores each block is displayed in. Block templates are handled separately from CMS content and local content, so you can build different blocks for different languages.

Each placeholder in a block has locale-specific content (for as many locales as you have).

Reusing CMS blocks

If you add a CMS block to multiple pages and edit it, the content is updated on all the pages you’ve added it to. This applies to the content and the configuration of blocks. For example, if you update a picture in a block, the new picture is displayed on all the pages the block is added to. Or, if you update the store relation, the block stops being displayed on the pages of the store the block is not configured to be displayed on.

Create CMS blocks
Edit CMS blocks

See next