Skip to content

Instantly share code, notes, and snippets.

@dominikwilkowski
Created February 13, 2014 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominikwilkowski/8968404 to your computer and use it in GitHub Desktop.
Save dominikwilkowski/8968404 to your computer and use it in GitHub Desktop.
This snippet displays "is-first" or "is-last" within a loop for class names
{% comment %}
This snippet displays "is-first" or "is-last" within a loop for class names
Usage:
{% for p in collection.products %}
<li class="{% include 'for-looper' %}"> ... </li>
{% endfor %}
Return:
no return
Required:
Needs to be called within a for loop
{% endcomment %}
{% if forloop.first %}first{% endif %} {% if forloop.last %}last{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment