6/7/2017 - 3:35 PM

Adding more information to Taxonomies

Adding more information to Taxonomies

This applies to Categories, tags, etc.

My template uses a taxonomy called Series (or stories) and I needed to add more information to it.

The solution I found, which includes some posts here in the forum, was to use the Data folder.

There is a TOML file at data/series/ with the same name as the series. Like story-name.toml. After which I cycle through the information to make sure it matches.

TOML data file:

slug = "uxlx15"
name = "UX Lx 2015"
description = "User Experience Lisbon"

and then the template at terms.html:

{{ range $key, $value := .Site.Taxonomies.series }}
{{ range $.Site.Data.series }}
{{ if eq $key .slug }}
<article class="mini-post stories">
        <p>{{ .description }}</p>
    <a href="{{ $baseurl }}series/{{ $key | urlize }}/" class="image mini-featured-image" style="background-image: url('{{ $baseurl }}series/{{ $key | urlize }}/{{ $key | urlize }}_header.jpg');">
        <h3>{{ .name }}</h3>