Skip to content

Instantly share code, notes, and snippets.

@maoo
Last active April 7, 2018 12:06
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 maoo/c41d6ebb48af5165812f74d264c14d4e to your computer and use it in GitHub Desktop.
Save maoo/c41d6ebb48af5165812f74d264c14d4e to your computer and use it in GitHub Desktop.
Hubspot - Multiple columns in blog listing
{% set items = contents|length %}
{# Change '3' with the number of columns you'd like to display #}
{% set itemsPerColumn = items|divide(3) %}
{% for row in contents|batch(itemsPerColumn, ' ') %}
<div class="column span{{ itemsPerColumn }}">
{% for content in row %}
<div class="post-item">
....
</div>
{% endfor %}
</div>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment