One of the things I really like about my Jekyll site, was that I could work with data files to loop through data an spit out structured content. On my personal site, this was useful for things like my blogroll and my Projects page.

I wanted to have the same feature with Pure Blog, so I built it.

What is a data file?

It is just a small YAML file that holds a list of items. For example:

- name: "Pure Blog"
  url: "https://pureblog.org"
  comment: "A lightweight, flat-file blogging platform."

You can store these in a /data folder in the root of your Pure Blog install, e.g:

  • data/blogroll.yml
  • data/projects.yml

How do you use it in a page?

In your page content you can include a loop, like this:

{% for site in site.data.blogroll %}
<div class="card">
  <h2>{{ site.name }}</h2>
  <p>{{ site.comment }}</p>
  <a class="button" href="{{ site.url }}">Visit</a>
</div>
{% endfor %}

Pure Blog will replace that loop with your actual items at render time. I use this for my blogroll and projects page and it keeps things tidy.