Skip to content

Instantly share code, notes, and snippets.

@vegetableman
Last active August 29, 2015 13:58
Show Gist options
  • Save vegetableman/9953330 to your computer and use it in GitHub Desktop.
Save vegetableman/9953330 to your computer and use it in GitHub Desktop.
liquid template - contains, assign, split, append, forloop.index0
{% for img_dir in site.imagemap %}
{% if img_dir.size > 0 %}
{% assign img_category_arr = (img_dir[0] | split: '-') %}
{% assign img_category = img_category_arr[1] %}
{% for img_item in img_dir[1]%}
{% if img_item contains 'main' %}
{% assign img_path = (img_dir[0]|append: '/'|append: img_item) %}
{% picture {{img_path}} data-category="{{img_category}}" data-index="{{forloop.index0}}" %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment