continue

Skip the remainder of the current loop iteration and immediately advance to the next element.

Syntax

{% for item in array %} {% if condition %} {% continue %} {% endif %} ... {% endfor %}

Example

{% assign items = "A,skip,B" | split: "," %}{% for item in items %}{% if item == "skip" %}{% continue %}{% endif %}[{{ item }}]{% endfor %}

Output

[A][B]

The continue tag aborts the current cycle of a for loop and immediately moves to the next element without terminating the entire iteration. It is ideal for filtering out unwanted elements during page rendering.

In keyword combination templates, continue filters out self-referencing links when displaying related page collections. For example: {% for sibling in page.related %}{% if sibling.path == page.path %}{% continue %}{% endif %}<li><a href="{{ sibling.path }}">{{ sibling.title }}</a></li>{% endfor %}. This eliminates self-links cleanly.

Try this syntax in the editor.