How to "nest" taxonomies?

I’m trying to implement the following logical “entity relationship”:

category
    event
        track

So the track elements are regular pages having event: <event_id> in the front matter. So far so good.

Now, event pages are list pages, so I’ve created the following file layout:

content/
    events/
        eventA/
            _index.md
        eventB/
            _index.md
        ...

These _index.md above look like:

---
title: The Great Event
category: cat1
---

And here some text about the event.

The problem is, as I understand, that a list page (_index.md) cannot be assigned to a taxonomy, so the categories taxonomy is empty.

How should this be solved in “Hugo way”? Do I need to create two files for each event, _index.md and index.md? This sounds ugly, also, where do I put the event description then? For list pages it’s only possible in _index.md, no other options.

It’s kinda hard for me to see what your website is supposed to look like at the end. If you are sure you want to relate sections and categories like that, I’d look at:

If you’d like to hash out your content structure more, let me know and I’ll dig in. :slight_smile:

I don’t think Related is the right way to do that as it’s undeterministic, whereas I want category to be unambiguously linked to a number of events, just like a taxonomy does.

What I want is to relate tracks to an event, and every event to a category, so it’s a classic one-to-many relation, but with two levels:

  • A category has multiple events
  • An event has multiple tracks

My dilemma is that, according to Hugo docs, event as a taxonomy term must be described in /content/events/<event_name>/_index.md, but if I want to link an event further to a category, I cannot do it in the same file - Hugo only takes taxonomy relations from regular pages (and _index.md is a list page).

Any ideas?

Have you run into that issue with related content? I think making events pages, which have a category, and relating tracks pages to events, you get what you want.

I’ll be honest, I’m half guessing at what “undeterministic” means in this context. :slight_smile:

I worked around it (ex. for tags)

content/tag/_index.md for the lists

+++
categories  = ["Tags"]
title       = "Index"
description = "Index - all tags"
layout      = "tags"
+++

with layout/tag/list.html for tag listing
with layout/tag/tags.html to render _index.md

PS
Sample repo is here https://github.com/gj52/HugoSample

With that I mean that “Related” is by definition some fuzzy algorithm that finds out what else you might be interested in on a given page (if I get that right). And it also doesn’t guarantee any particular sequence, whereas tracks have a well-determined order within an event, it’s just like music tracks within an album.

I couldn’t quite figure out what you meant by that.

It’s not that it’s impossible to relate categories to events to tracks, eventually I managed to sort this out. I would prefer, however, to employ the standard taxonomy mechanism of Hugo instead of hacky list filtering and stuff :slight_smile:

PS. My code is here, this question was about videocategories ⇒ videoevents ⇒ videotracks. The website is https://yktoo.com/ .

a had to reduce your repo to the minimum (on my pc)

layouts/videoevent/list.html

{{ $paginator := .Paginate (sort (where .Data.Pages "Type" "videoevent") ".Params.datefrom" "desc") }}
{{ template "_internal/pagination.html" . }}
{{ range $paginator.Pages }}
   {{.Params.datefrom}} - {{.Params.dateto}} *** {{ .Title }}
{{ end }}

WIth this paging you can go backward!
Page-level .Params are only accessible in lowercase.

have changed /content/videoevents/_index.en.md

---
# To prevent Hugo from generating an index.html, which will overwrite the home page alias at this location 
type: videoevent
aliases:
    - /en/video/events/
---

hope, this helps for the next step