block

A block represents the content and settings of a single block in an array of section blocks. The block object can be accessed in a section file by looping through section.blocks.

{% for block in section.blocks %}
  <!-- output block content -->
{% endfor %}

The block object has the following attributes:

block.id

Returns a unique ID dynamically generated by Shoplazza.

block.settings

Returns an object of the block settings set in the theme editor. Retrieve setting values by referencing the setting's unique id.

<img src="{{ block.settings.image | img_url: '800x' }}" alt="{{ block.settings.image.alt }}" />
<img  src="//cdn.shoplazza.com/.../promo-banner1_800x.jpg" alt="New season - Spring 2017">

block.type

Returns the type defined in the block's schema. This is useful for displaying different markup based on the block.type.

{% for block in section.blocks %}
  {% if block.type == 'advert' %}
    <!-- output an image with a link -->
  {% elsif block.type == 'headline' %}
  {% endif %}
  <!-- output a header with text -->
{% endfor %}

Did this page help you?