Skip to content
Honmaple
Documentation navigation

Taxonomies

On this page

Snow generates taxonomy pages from page front matter, similar to taxonomies in Hugo or Zola.

Usage

List field names beneath taxonomies to group pages by those fields and generate a list page and individual term pages.

Values such as Programming/Go create a hierarchy: the parent term Programming contains the child term Go.

Configuration

taxonomies:
  _default:
    path: "{taxonomy}/"
    sort_by: "name"
    term:
      path: "{taxonomy}/{term:slug}/"
      sort_by: "weight,date desc,title"
  tags:
  categories:
  authors:

Listing a taxonomy name enables it.

Taxonomy Settings

Under taxonomies.{name}:

Setting Default Description
path {taxonomy}/ List page path
path_style none See Path Style
template None Custom template
sort_by name Order terms by name or count

Term Settings

Under taxonomies.{name}.term:

Setting Default Description
path {taxonomy}/{term:slug}/ Term page path
path_style none See Path Style
template None Custom template
sort_by weight,date desc,title Order pages in the term
filter_by None Page filter
paginate None Items per page; unset disables pagination
paginate_path Automatic Pagination path template
paginate_filter_by None Filter before pagination

Settings fall back from taxonomies.{name}.{key} to taxonomies._default.{key}. See Pagination for default pagination paths.

Front Matter

---
tags:
  - go
  - web
  - tutorial
categories:
  - Programming/Go
authors: honmaple
---

Slashes create nested terms.

Path Variables

List pages support {lang}, {lang:optional}, and {taxonomy}. Term pages also support {term} (the original name) and {term:slug} (its slugified form). The optional language value is empty for the default language.

Template Lookup

List pages:

  1. taxonomies.{name}.template.
  2. {name}/list.html.
  3. taxonomy_list.html.

Term pages:

  1. taxonomies.{name}.term.template.
  2. {name}/single.html.
  3. taxonomy_single.html.

Template Variables

List Templates

Property Description
taxonomy.Name Taxonomy name
taxonomy.Lang Language
taxonomy.Path Relative URL
taxonomy.Permalink Absolute URL
taxonomy.Terms All terms
terms Alias for taxonomy.Terms

Term Templates

Property Description
term.Name Term name
term.Slug Slug
term.Path Relative URL
term.Permalink Absolute URL
term.Pages Pages in this term
term.Children Child terms
term.Parent Parent term
term.Formats Additional output formats
term.Taxonomy Owning taxonomy
paginator Pagination context

Use term.Pages for the current term's pages; pages is not a local alias.

Date Archives

Group pages by year and month:

taxonomies:
  "date:2006/01":
    sort_by: "name desc"
    path: "archives/"
    template: "archives.html"
    term:
      path: "archives/{term}/"
      template: "period_archives.html"

date:2006/01 produces archive links such as /archives/2024/01/.

You can also group pages directly in a template:

{% for group in pages.GroupBy("date:2006-01").OrderBy("name desc") %}
  <h2>{{ group.Name }}</h2>
  {% for page in group.Pages %}
    <li>{{ page.Title }}</li>
  {% endfor %}
{% endfor %}