Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taufik-nurrohman/8c8180ce9c2efa3fb6890396ca09a475 to your computer and use it in GitHub Desktop.
Save taufik-nurrohman/8c8180ce9c2efa3fb6890396ca09a475 to your computer and use it in GitHub Desktop.
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