Skip to content

Instantly share code, notes, and snippets.

@MisterPoppet
Created May 19, 2015 14:21
Show Gist options
  • Save MisterPoppet/523b048f91b1676b5b3a to your computer and use it in GitHub Desktop.
Save MisterPoppet/523b048f91b1676b5b3a to your computer and use it in GitHub Desktop.
Columns with a Matrix Field
{% set inColumn = false %}
{% for block in entry.body %}
{% switch block.type %}
{% case 'columnBlock' %}
{% if inColumn %}
</div>
{% else %}
{% set inColumn = true %}
<div class="lucky grid">
{% endif %}
<div class="{{ block.mobileSize }} {{ block.desktopSize }} column">
{% case 'headerBlock' %}
<h{{ block.size }}>{{ block.textContent }}</h{{ block.size }}>
{% case 'textBlock' %}
{{ block.textContent }}
{% case 'imageBlock' %}
<img class="{{ block.position }}" src="{{ block.imageContent.first().url }}">
{% endswitch %}
{% endfor %}
{% if inColumn %}
</div></div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment