Overview

What a section module brings, and how it works with taxonomies

Overview

A section is a content type: posts, persons, projects, events, products… Each one is a Hugolify module of its own: add it to your modules, and both the website and the CMS get it.

What a section module brings

Taking the posts as an example:

  • The content type: the posts section, with its archetype and its front matter.
  • The templates: the list page with its pagination, the page of each entry (for posts: date, reading time, share links, table of contents, previous and next post), and the card of an entry, reused wherever the section is listed.
  • The structured data: each page publishes its schema.org data, built from the front matter.
  • The CMS collection: generated by Hugolify Admin, with the fields of the section. A field linking to a taxonomy shows up only when that taxonomy is installed.
  • The blocks: any page can list the section with the Latest block (the latest entries) and the Selected block (entries picked one by one, or every entry matching some taxonomy terms).

Sections and taxonomies

A section shows only what is installed. Add a taxonomy module next to it, and its templates plug into the ones of the section, with nothing to configure:

  • On the list page, a Filter button opens the terms of each taxonomy. It shows up as soon as one entry of the section has a term.
  • On the cards and on the entry pages, the terms of the entry: for posts, the categories next to the date, the tags in the sidebar.
  • In the CMS, a field on each entry to pick its terms, and a taxonomies source in the Selected block.

The section module looks for the templates of its taxonomies, and renders them when their module is there: remove the module, and they go away with it.

Relations between sections

Some taxonomies link two sections: their terms are the entries of another section. With posts authors, the authors of a post are persons:

  • in the CMS, an Authors field on each post, picking from the persons;
  • on the post, its authors;
  • on the page of a person, their latest posts, with a link to all of them.

The other relations work the same way: publications persons, events persons, services persons, realestates persons… Both sections must be installed.

Setup

Content modules come first, the core theme last:

/config/_default/module.yaml

imports:
  # Content
  - path: github.com/hugolify/hugolify-theme-posts-categories/v2
  - path: github.com/hugolify/hugolify-theme-posts-tags/v2
  - path: github.com/hugolify/hugolify-theme-posts/v2

  # Core theme
  - path: github.com/hugolify/hugolify-theme/v2

Then run yarn install:hugolify to download them.