Section Schema

Sections support a Handlebars helper designed for sections, the {{#schema}} tag. This tag lets you define different attributes of a section, such as the section name, section blocks, and settings that allow customization in the theme editor.


Schema

Each section can have only one {{#schema}} tag, and it must contain valid JSON data. It cannot be nested within other Handlebars tags. The schema consists of the following properties:

Note

{{#schema}} is a Handlebars helper. However, it does not output its contents or render any included Handlebars.


Content

The content within {{#schema}} can include the following properties:

Name

The name property determines the section title displayed in the theme editor. For example, the following schema will display the output below:


Output:
image.png


Class

When SHOPLINE renders a section, it is wrapped in an HTML element with the shopline-section class. You can define this element's class value using the class property, such as:


This will output the following HTML snippet:


Settings

You can create section specific configuration options using the settings object, allowing merchants to customize the section:


Note

All section setting IDs must be distinct within each section. Repeated IDs within a section will cause errors.


Accessing Section Settings

Section settings can be accessed via the section Handlebars object. Refer to Access Settings for more information.

Tip

If a section is statically rendered, it will only have one instance in all static renders, meaning they share the same section settings values.

Blocks

You can create blocks within a section. Blocks are reusable content units that can be added, removed, and rearranged within a section.

Blocks have the following properties:

PropertyDescriptionRequired
nameThe name of the block, displayed as the block title in the theme editor.Yes
typeThe type of block. This is a free-form string used as an identifier and can be accessed via the Handlebars block object’s type property.Yes
settingsAny settings you want to apply to the block. Some settings may be used as the block title in the theme editor.No
limitThe amount of blocks of this type that can be used.No
iconThe icon displayed to the left of the block drag area in the design panel. If not configured, the default icon is: image.png. Supported icons include:
- comment: image.png
- navigation: image.png
- email: image.png
- image: image.png
- imageText: image.png
- post: image.png
- product: image.png
- productCategories: image.png
- text: image.png
- video: image.png
- title: image.png
- paragraph: image.png
- button: image.png
- normal: image.png
No

Below is an example of a section with blocks.


Note

All block names and types must be distinct within each section, and all setting IDs within each block must be unique. Duplicates will cause errors.


Accessing Block Settings

Block settings can be accessed via the Handlebars block object. Refer to Access Settings for more information.

Was this article helpful to you?

Error loading component.

Error loading component.