Iterate over hashes in liquid templates

Solution 1:

When you iterate over a hash using a variable called hash, hash[0] contains the key and hash[1] contains the value on each iteration.

{% for link_hash in page.links %}
  {% for link in link_hash %}
    <a href="{{ link[1] }}">{{ link[0] }}</a>
  {% endfor %}
{% endfor %}

Solution 2:

I would define them like this in YAML:

links:
  demo: http://www.github.com/copperegg/mongo-scaling-demo

And then iterate:

{% for link in page.links %}
  <a href="{{ link[1] }}">{{ link[0] }}</a>
{% endfor %}