when

Declare one or more matching values within a case block to trigger specific template markup.

Syntax

{% case variable %} {% when value1, value2 %} ... {% endcase %}

Example

{% assign fruit = "apple" %}{% case fruit %}{% when "banana" %}Yellow Fruit{% when "apple" %}Red Fruit{% endcase %}

Output

Red Fruit

The when tag defines one or more target values within a surrounding case statement. When the inspected variable matches any listed value, its associated block renders. Multiple values can be separated by commas.

In programmatic landing page templates, when tags group similar attribute values into unified presentation blocks. For example: {% case row.coverage %}{% when 'downtown', 'metro' %}<span class="badge">Express 30-Min</span>{% when 'rural' %}<span>Scheduled</span>{% endcase %}. This pairs dynamic badges with rows.

Try this syntax in the editor.