Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll - Liquid Exception: Unknown operator forloop

I've updated jekyll and now get this error:

Liquid Exception: Unknown operator forloop in collection.html

Here's the code in question:

{% for tag in site.content_data.tags %}{{ tag }}{% if not forloop.last %}, {% endif %}{% endfor %}

How would I resolve this error?

like image 286
Dan Cormier Avatar asked Jul 16 '13 16:07

Dan Cormier


2 Answers

I suspect your {% if not forloop.last %} is not the valid syntax, as I don't see it in the operators section.

Have you tried {% if forloop.last == false %}?

like image 185
Yi Zeng Avatar answered Nov 05 '22 16:11

Yi Zeng


Not to contradict Yi Zeng, but you can also solve this issue using:

{% unless forloop.last %}something{% endunless %} 
like image 6
Damian Avatar answered Nov 05 '22 14:11

Damian