A plugin for Pico to add tagging functionality.
Branch: master
Clone or download
Latest commit 7a8e464 Jun 21, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit of plugin, readme, and .gitignore Sep 16, 2015
LICENSE Initial commit Sep 16, 2015
PicoTags.php Fixed repository URL Jun 20, 2016
README.md Add description to blog post example Apr 25, 2016


Pico Tags

A plugin for the flat file CMS Pico. Using this plugin, you can use the Tags and Filter headers in the page meta block in order to modify the pages array for pages of your choice. This creates the possibility to feature index pages which show only posts of a certain type.

The Tags header accepts a comma-separated list of tags that apply to the current page.

The Filter header also accepts a comma-separated list of tags, but instead specifies which pages end up in the pages array. A page with no Filter header will have an unfiltered list of pages, whereas a page that specifies the header Filter: foo, bar will receive in its pages array only pages having at least one of those two tags.


Copy the file PicoTags.php to the plugins subdirectory of your Pico installation directory. That's it!


To assign tags to a page, specify the Tags header inside the meta header block at the top of your file, e.g.:

In blog/my-first-blog-post.md

Title: My first blog post
Date: 2015-09-16 13:37:00
Description: A thrilling, must-read blog post about pancakes.
Tags: blog, pancakes
Template: blog-post

To only show pages with certain tags on another page, use the Filter header, e.g.:

In blog/index.md

Title: Blog
Filter: blog
Template: blog-list

These are all my blog posts:

Actually looping through the filtered list of pages (in the above case, pages tagged blog) to display them would be done in the template file, e.g.:

In themes/default/blog-list.html

{{ content }}
{% for page in pages if page.title %}
        <h2><a href="{{ page.url }}">{{ page.title }}</a></h2>
        <p>{{ page.description }}</p>
{% endfor %}