Skip to main content

Blocks, Layouts & Sections

Blocks are the building elements of your template. Each block represents a reusable component that can be added to pages or layouts.

The blocks.json file defines all available blocks, their type, styles, nested elements, and icons.


πŸ—οΈ Usage in Layouts & Sections​

  • Blocks can be inserted in pages or sections
  • Layout files include blocks by referencing their key
  • Editors can add blocks dynamically through the block editor
  • The blocks.json defines the heart of your template’s flexible content system, enabling complex layouts, sliders, product lists, and rich content areas.

πŸ“„ Example blocks.json​

{
"slider": {
"name": "Slider",
"type": "slider",
"icon": "<svg ...></svg>",
"blocks": [
{
"name": "Slides",
"key": "slides",
"type": "array",
"blocks": [
{ "name": "Title", "key": "title", "type": "text", "main": true, "translate": true },
{ "name": "Text", "key": "subtitle", "type": "text", "translate": true },
{ "name": "Link", "key": "link", "type": "link" },
{ "name": "Button text", "key": "button_text", "type": "text", "translate": true },
{ "name": "Portrait image", "key": "portrait_src", "type": "image", "image": "cover" },
{ "name": "Landscape image", "key": "landscape_src", "type": "image", "image": "cover" },
{ "name": "Alt text", "key": "alt", "type": "text", "translate": true }
],
"styles": [
{ "name": "Show over the previous element", "key": "f_slider", "class": "f-slider" },
{ "name": "Text position", "key": "text_style", "classes": { "": "Under the slides", "slide-text": "Bottom of the slides" } },
{ "name": "Button style", "key": "button_style", "classes": { "btn-primary": "Primary", "btn-white": "White" } }
]
}
]
},
"top-products": {
"name": "Top products",
"type": "featured-products",
"icon": "<svg ...></svg>",
"blocks": [
{ "name": "Title", "key": "title", "type": "text", "translate": true },
{ "name": "Image", "key": "src", "type": "image", "image": "cover" },
{ "name": "Alternative text", "key": "alt", "type": "text" },
{ "name": "Products", "key": "global", "type": "featured-products" }
]
}
}

This snippet shows two blocks (slider and top-products) as examples. The full blocks.json contains all blocks defined in your template, such as product-slider, text, store, image-with-text, html, pictures, category-slider, content-toggle, video, product-mix, filter, pagination, and social-reviews.


βš™οΈ Block Structure​

KeyDescription
nameHuman-readable name of the block
typeType of block (slider, featured-products, text, html, etc.)
iconInline SVG icon shown in editor
blocksNested content elements of this block
stylesOptional styling options for block display
dynamic_dataOptional dynamic content source

Types​

Main types​

The type value can be anything you want, but there are some pre-defined types, with their own default structure:

KeyDescription
featured-productsThis shows products selected in the block editor section.products variable contains the products
storeShow store locations data stores contains the avalible stores
paginationPagination for lists pages. The paginator variable contains the paginator
featured-categoriesFor later use
featured-postsThis shows external platform posts selected in the block editor section.posts variable contains the posts

Block variable types​

KeyDescription
textText variable
imageImage variable. Can be used in twig with image_url and image_srcset
videoVideo variable. Can be used in twig with video_poster and video_srcset
rich-textwysiwyg edited text
htmlRaw HTML
arrayUsed to create nested sub-blocks


🧩 Nested Blocks​

Many blocks support nested blocks, for example:

  • Slider β†’ Slides β†’ Title, Text, Image, Link
  • Category boxes β†’ Slides β†’ Title, Subtitle, Badge, Image

Nested blocks allow content editors to add multiple items dynamically inside a block.


🎨 Styles & Classes​

Each block may have optional styles, which control the block's appearance:

{
"name": "Text position",
"key": "text_style",
"classes": {
"": "Under the slides",
"slide-text": "Bottom of the slides"
}
}
  • key β†’ used in templates
  • classes β†’ maps editor options to CSS classes
  • class β†’ single CSS class without multiple options

Those can be configured in the Style block in the block editor. The values are in the section.settings.key variables in the Twig section.


Dynemic block​

With dynamic_data you can select your data from the database.

Example

{
"integrationReviews": {
"model": "IntegrationReview",
"filters": [
{
"type": "tag",
"name": "language_code",
"variable": "locale.code"
},
{
"type": "tag",
"name": "show_in_website",
"value": [1]
}
],
"sort_by": ["posted_at","DESC"],
"limit": [0,12]
}
}

Possible models​

ModelDescription
IntegrationReviewReviews from 3rd party sources, like Google Maps Reviews, Facebook Page reviews, etc.
IntegrationPostPosts from 3rd party sources, like Facebook, Instagram, TikTok, etc.

Possible filter modes​

Filter typeDescription
tagRows that contains one of the listed value
numberRows that between the min and max value