Github Pages + Popolo

One of the oddities of Github Pages is that they can natively deal with JSON data files … as long as you pretend that they’re YAML files!

So, if drop my Eduskunta-Popolo parties.json file into the _data directory, it won’t work. But if I simply rename it as parties.yaml it will suddenly become available in templates correctly:


---
layout: default
---

<ul>
{% for party in site.data.parties %}
<li> {{ party.name }} </li>
{% endfor %}
</ul>

Leave a Reply

Your email address will not be published. Required fields are marked *