I would like to skip an iteration based on a condition.
I'm using liquid templates as part of Jekyll.
I don't see a continue in the docs:
http://www.rubydoc.info/gems/liquid/Liquid/For
{% for page in site.pages %}
{% if page.url == '/index.html' %}
// Continue here
{% endif %}
{{ page.title }}
{% endfor %}
You can use the continue tag, which works just like a continue
in any other language. It's documented in a separate section:
{% for page in site.pages %}
{% if page.url == '/index.html' %}
{% continue %}
{% endif %}
{{ page.title }}
{% endfor %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With