Data Files
Cobalt reads data from any yaml, json, and
toml files in the _data
directory
and merges them into the site.data
variable, making
them available as site.data.<DIR>.<FILE>
.
Example
In _data/animals/dogs.yml
:
- name: Corgi
- name: Malamute
which liquid templates can access via site.data.animals.dogs
.
You can now render the list in a template:
<ul>
{% for breed in site.data.animals.dogs %}
<li>{{ breed.name }}</li>
{% endfor %}
</ul>