Last active
August 29, 2015 14:24
-
-
Save thisislawatts/0be5d3d424e874c81e8c to your computer and use it in GitHub Desktop.
Liquid Counter Loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
I only want to echo out `Do something` six times on this page | |
But `something_we_cant_limit might` could contain 22 items or 2 | |
{% endcomment %} | |
{% assign counter = 'i' %} | |
{% for item in something_we_cant_limit %} | |
{% capture counter %}{{ counter }}i{% endcounter %} | |
{% if capture.size < 6 %} | |
Do something | |
{% endif %} | |
{% endfor %} | |
{% for item in something_unrelated_you_cant_limit %} | |
{% capture counter %}{{ counter }}i{% endcounter %} | |
{% if capture.size < 6 %} | |
Do something | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment