Guest User

Untitled

a guest
Mar 13th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. {# Assuming a page object with one or more instances of a content block: #}
  2. {% for block in page.blocks %}
  3. {# Start a new row every third block. #}
  4. {% cycle '<div class="row">' "" "" %}
  5. <div class="col-md-4">
  6. {{ block }}
  7. </div>
  8. {# End every third row. #}
  9. {% cycle "" "" '</div>' %}
  10. {% endfor %}
  11.  
  12. {# The row div will need to be closed if the total blocks is no divisible by 3. #}
  13. {% if not page.blocks|length|divisibleby:"3" %}</div>{% endif %}
Add Comment
Please, Sign In to add comment