Taxonomies
Taxonomies let you group and cross-reference content. The most common taxonomy is Tags. SuCoS automatically generates list pages for each taxonomy term.
Tags
Add Tags to any page's front matter:
---
Title: Getting Started with SuCoS
Tags:
- tutorial
- beginner
---
SuCoS automatically creates:
/tags/— list of all tags/tags/tutorial/— list of pages taggedtutorial/tags/beginner/— list of pages taggedbeginner
Linking to tag pages
From any template, you can link to a page's tags:
{% for tag in page.Tags %}
<a href="{{ tag.Permalink }}">{{ tag.Title }}</a>
{% endfor %}
Listing all tags on a page
To build a tag cloud or nav, iterate over all tag pages:
{% assign tags = site.RegularPages | where: 'Section', 'tags' | sort: 'Title' %}
{% for tag in tags %}
<a href="{{ tag.Permalink }}">{{ tag.Title }} ({{ tag.Pages | size }})</a>
{% endfor %}
Tag page templates
Tag term pages (e.g. /tags/tutorial/) use the term.html template. The taxonomy index page (/tags/) uses taxonomy.html. Both templates have access to page.Pages, which contains all pages with that tag.
Example term.html:
<h1>Posts tagged: {{ page.Title }}</h1>
<ul>
{% for post in page.Pages %}
<li><a href="{{ post.Permalink }}">{{ post.Title }}</a></li>
{% endfor %}
</ul>