Tags control the logic and flow of the document rendering process.
Wrap tags in {% ... %}
blocks.
Use tags in the template to create documents with the right content for the desired store order and document type. For example, you can show different content based on conditions using if
statements or iterate through properties using for
loops.
Conditional tags determine whether a piece of a template is rendered, depending on whether a condition is True
or False
.
Renders the expression if a specific condition is True
. Skips the expression if the condition is False
.
Caution
Please note that while Shopify uses elsif
in their syntax, in Sufio, this tag is called elif
.
Iteration tags repeatedly iterate through a group of properties.
Renders an output for every item in an array or property in a group of properties.
Limit the number of iterations
You can limit the number of iterations in a for
loop.
In this example, the loop iterates over the first two properties in the group.
Offset the iteration
You can skip a certain number of items at the beginning of the for
loop.
In this example, the loop skips the first two properties and iterates over the rest.
Specify a range to iterate
You can specify a range to iterate over.
In this example, the loop skips the first property and stops after iterating the second property.
Reverse the order of iteration
You can iterate in reverse order using the reverse
filter.
A group of properties that contain information about the parent for
loop. You can render the following properties inside the loop.
loop.index
The number of the current iteration of the loop. The numbers are sequential and start at 1.
loop.index0
The number of the current iteration of the loop. The numbers are sequential and start at 0.
loop.revindex
The number of iterations from the end of the loop. The numbers are sequential and start at 1.
loop.revindex0
The number of iterations from the end of the loop. The numbers are sequential and start at 0.
loop.first
Returns True
if the current iteration is the first.
loop.last
Returns True
if the current iteration is the last.
loop.length
The number of items in the sequence.
Variable tags let you create new variables and assign values to them.