Dan Cormier
Dan Cormier

Reputation: 544

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?

Upvotes: 9

Views: 3586

Answers (2)

Damian
Damian

Reputation: 61

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

{% unless forloop.last %}something{% endunless %} 

Upvotes: 6

Yi Zeng
Yi Zeng

Reputation: 32895

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 %}?

Upvotes: 19

Related Questions