Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.