Pico Setup

09/29/20 • Carsten Haubold

Phew, I didn't think it would take this long to set up a page with Pico. I mean... The general setup is done quickly, hacking around in the twig templates works quite nicely, and configuring it to behave like a blog was also done quickly.

But here comes the crux: tags. I added the plugin Pico-Tags, and wanted to get:

  1. the tags (which are encoded in the page header YAML) to be shown on a page
  2. the tags to be shown in my listing of blog posts
  3. to get summary pages to work that show which blog posts use what tags

1 and 3 were done rather quickly, after I figured out that the links have to be in the form chaubold.de/pico/?tags&tag=sometag.

But item 2 keept me busy... I was able to access page.meta.tags as an item, but not as an array. So I had to use the template engine twigs' filter capabilities to split tag1,tag2,tag3 into three separate tags. Actually not that bad, but it eludes me why I had to split it myself...

{% for tag in page.meta.tags|split(',') %}
    &bull;&nbsp; <a href="{{ base_url }}?tags&tag={{ tag }}"> #{{ tag }} </a>
{% endfor %}