1. Home
  2. Liquid
  3. For loop last item

Use forloop.last to select the last item in the for loop.

#liquid#for#loop#last
<ul>
{% for page in site.pages %}
  <li>
      <a title="{{ page.title }}" href="{{ page.url }}">{{ page.title }}{% if forloop.last == true %} - last item{% endif %}</a>
  </li>
{% endfor %}
</ul>
copy
Full Liquid cheatsheet
NordVPN NordVPN