Overview

What a taxonomy module brings, and how to set its filters

Overview

A taxonomy groups the entries of a section: the categories of products, the tags of posts, the expertises of persons… Each one is a Hugolify module of its own, added next to the module of its section.

What a taxonomy module brings

Taking the products categories as an example:

  • The Hugo taxonomy: products_categories, declared by the module, nothing to add to your config.
  • The URLs: the list of terms at /products/categories/, each term at /products/categories/:slug/.
  • The templates: the list page, the term page with the entries filed under it, and the terms shown on each item.
  • The filters: shown on the list page of the section and on the term pages, as soon as the module is installed.
  • The CMS collection: editors create the terms, then pick them on each entry through a relation field, several at once.

Setup

Import the taxonomy module before its section module, and the core theme last:

/config/_default/module.yaml

imports:
  - path: github.com/hugolify/hugolify-theme-products-categories/v2
  - path: github.com/hugolify/hugolify-theme-products/v2
  - path: github.com/hugolify/hugolify-theme/v2

Then run yarn install:hugolify to download it.

A section takes as many taxonomies as you need: see the Products section with its categories and tags.

Filters settings

The filters open in a drawer, from the Filter button of the list page:

/config/_default/params.yaml

filters:
  drawer:
    position: end # start | end | top | bottom
  more:
    enable: false # true folds the terms past limit behind a "show more"
    limit: 5 # terms shown per taxonomy before the fold
  search:
    enable: false # true adds a field narrowing the terms

more and search need hugolify-theme-design-system.

Relations between sections

Some taxonomies link two sections, the authors of a post being persons for one: see relations between sections.