Skip to content

Instantly share code, notes, and snippets.

@johanbove
Last active August 29, 2015 14:22
Show Gist options
  • Save johanbove/e6aae743e82ab9fb7bc8 to your computer and use it in GitHub Desktop.
Save johanbove/e6aae743e82ab9fb7bc8 to your computer and use it in GitHub Desktop.
liquid template blocks with columns
{% for block in site.data.[site.lang].general.footer.blocks %}
{% assign colCount = forloop.length | plus: 1 %}
{% assign colWidth = 12 | divided_by: colCount %}
<div class="col-md-{{ colWidth }} col-xs-6">
<h5>{{ block.title }}</h5>
<ul>
{% if block.links != empty %}
{% for linkElement in block.links %}
<li><a href="{% if linkElement.permalink != null %} {{ linkElement.permalink | prepend: site.baseurl }} {% else %} {{ linkElement.link }} {% endif %}" {% if linkElement.link != null %}target="_blank"{% endif %}>{{ linkElement.text }}</a></li>
{% endfor %}
{% endif %}
{% if block.contacts != empty %}
{% for contactElement in block.contacts %}
<li>{{ contactElement.label }} {{ contactElement.value }}</li>
{% endfor %}
{% endif %}
</ul>
</div>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment