Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generate text “foo, bar, baz and qux” from array input in Liquid by https://github.com/mecha-cms
{% assign total_items = items.size %}
{% for item in items %}
{% if forloop.index > 1 %}
{% if forloop.index != total_items %}, {% else %} and {% endif %}
{% endif %}
{{ item }}
{% endfor %}
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.