Last active
August 29, 2015 14:27
-
-
Save opattison/fdc0067b0a6ae266715f to your computer and use it in GitHub Desktop.
Liquid: loop index reference within a 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
{% for image in page.image %} | |
<img src="{{ site.image-url }}/{{ page.image[forloop.index0].src }}" | |
sizes="{{ site.wide-sizes }}" | |
srcset="{% assign parentloop = forloop %} | |
{% for srcset1440 in site.srcset1440 %} | |
{{ site.image-url }}/{{ site.srcset1440[forloop.index0] }}/{{ page.image[parentloop.index0].src }} {{ site.srcset1440[forloop.index0] }}w{% if forloop.last == false %}, | |
{% endif %}{% endfor %}" | |
> | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Key part:
{% assign parentloop = forloop %}