Pulling taxonomy terms from taxonomy page _index.md files?

Hi all, first time poster with extremely minimal programming experience, so please forgive me if my questions ramble or reveal my lack of understanding.

I have a sci-fi/fantasy discussion podcast, and after a few years of fumbling around with Wordpress sites and getting frustrated when each security, theme, or plug-in update would break some part of my site, the audio player, or both, a good friend who had previously moved to hugo set me up with his very clean, basic theme, directed me to documentation and discussions, and after studying just enough to know what I needed to know to make it work, I got the hugo version of my site up and running.

The site makes extensive use of taxonomies, because I have the long-term goal of using the site to create a “mini-wiki” of the actors, shows, movies, and shared universes discussed in various episodes. The actor taxonomy pages should be organized lists of all the places that actor is mentioned. The show and movie pages should give basic info on the show or movie (youtube trailer, synopsis, actors, external links). Universe pages list what shows and movies share a cinematic universe.

I launched this around hugo 0.55, and I did it by including _index.md pages for each movie, show, and universe taxonomy page. Each of those _index.md pages included all the other taxonomies relevant to that show/movie/universe, etc.

I tried to write an example with a ton of links to use as examples, but new users are restricted to two links. So feel free to check out my site and navigate around, but I can’t directly link to most of it.

So for example, let’s say you arrived at the podcast notes for the Arrowverse season wrap up from last year. The taxonomies are listed at the bottom of the page. Let’s say from there you wanted to check out the actor Stephen Amell:

That page shows you every episode that he’s mentioned in, along with the shows he’s been on and movies he’s been in that are discussed on the podcast. So from there, you could check out his latest movie, Code 8, and that would guide you to a very recent podcast, in which we discussed the movie Code 8.

The way I did this (via _index.md files for each show and movie taxonomy page that lead to other taxonomy pages) may be far from ideal, but it’s all my limited knowledge could suss out, and it seemed to work.

I remained on hugo 0.55 until very recently, where I updated to 0.70 (extended macOS version, if it matters). Suddenly, it seems all the taxonomy terms within _index.md files of other taxonomy pages were not getting read. So for example if you look at a recent episode, a discussion of Star Trek Picard, from there you could decide to look up lead actor Patrick Stewart: https://theomegabeam.com/actor/patrick-stewart/

You’ll see there’s no mention of the show page for Star Trek Picard, which definitely exists, and has Patrick Stewart listed in it. Nor does the “universe” page for the Star Trek franchise have any mention of any of the shows in that universe.

The way I was able to kludge together the Stephen Amell example with all the links is by duplicating the _index.md file for the show and movie he’s on, so that, for example, the /show/arrow/ folder contains two files: _index.md and arrow.md. The main page loads the _index.md file but the taxonomy term that gets picked up by the other pages ends up pointing to arrow.md. Right now, I have the server doing a 301 redirect of the duplicate information. But as I said, this is a kludge and clearly the wrong way round. As I also said, I don’t know what I’m doing. :slight_smile:

Was my way of trying to achieve what I wanted right for hugo 0.55, but it was removed subsequently, and I need to learn the new way? Was I always doing it wrong, it only worked by accident in hugo 0.55?

Now that you hopefully have an idea of what I’m trying to do, could you please give me some direction as to how best to go about it? It was never perfect before, so I’m happy to improve on it (for example, the actor pages should not just be an ugly single list, I’d like to pull the different taxonomies into their own organized lists).

Thanks for reading this far, and for any assistance!


Please summarize the problem statement, and provide a link to a public repository for your site.

Thanks for the response! Took me a while to set up a public repository.

Statement of problem: how can I pull taxonomy terms from the _index.md file for a taxonomy page, or is there a better way to include taxonomy terms that appear only in other taxonomy term pages?

You can find the site here: https://www.dropbox.com/sh/5uvq3r6zt1snhiy/AAAOdHE-AlppEb8D7go1rwzva?dl=0

Thanks again!


Let’s divide this problem into three parts:

  1. How and why did your site function as desired with Hugo version 0.55?
  2. Which code change(s) caused your site to stop functioning as desired?
  3. How can we get the desired behavior with the current version of Hugo?

I don’t have the time dig into Part 1 or Part 2, but I suspect one or both of the following are contributing factors:

  • You were relying on an undocumented behavior
  • Breaking page collection changes in Hugo version 0.57

In relation to Part 3 (the fix), your site was giving me a headache, so I created a simplified test site to demonstrate the problem and solution.

Simplified Test site

This site has two taxonomies, each with three terms:

  • Categories
    • category1
    • category2
    • category3
  • Tags
    • tag1
    • tag2
    • tag3

This site has one content type: post. There are three posts:

  • Post 1
    • Categories:
      • category1
      • category2
    • Tags:
      • tag1
      • tag2
  • Post 2
    • Categories:
      • category1
      • category3
    • Tags:
      • tag1
      • tag3
  • Post 3
    • Categories:
      • category2
      • category3
    • Tags:
      • tag2
      • tag3

There are taxonomy pages for each of the terms:

├── content
│   ├── categories
│   │   ├── category1
│   │   │   └── _index.md
│   │   ├── category2
│   │   │   └── _index.md
│   │   ├── category3
│   │   │   └── _index.md
│   │   └── _index.md
│   ├── post
│   │   ├── post-1.md
│   │   ├── post-2.md
│   │   └── post-3.md
│   └── tags
│       ├── tag1
│       │   └── _index.md
│       ├── tag2
│       │   └── _index.md
│       ├── tag3
│       │   └── _index.md
│       └── _index.md

Assign Terms to Taxonomy Pages

This is the unique aspect of the reported problem.

  1. The tag “tag1” is assigned to content/categories/category1/_index.md.
  2. The category “category1” is assigned to content/tags/tag1/_index.md.

Replicate the Problem

Install latest version of Hugo (0.71.1), then:

git clone --single-branch -b hugo-forum-topic-25848 https://github.com/jmooring/hugo-testing hugo-forum-topic-25848
cd hugo-forum-topic-25848
hugo server

When you visit http://localhost:1313/tags/tag1/ you will only see Post 1 and Post 2. This is not the desired behavior. We would also like to see a link to content/categories/category1/_index.md.

When you visit http://localhost:1313/categories/category1/ you will only see Post 1 and Post 2. This is not the desired behavior. We would also like to see a link to content/tags/tag1/_index.md.

The Fix

Edit config.toml, and change the custom site parameter includeListPagesInTaxonomyLists from false to true.

Now, when visiting either http://localhost:1313/tags/tag1/ or http://localhost:1313/categories/category1/, the missing pages are displayed.

If you don’t see any changes after changing this setting, clear your browser cache.


Take a look at layouts/_default/taxonomy.html.

{{- if .Site.Params.includeListPagesInTaxonomyLists -}}
  {{ $t := slice $term }}
  {{ $pages = where .Site.Pages (printf "Params.%s" $taxonomy) "intersect" $t }}
{{- else -}}
  {{ $pages = .Data.Pages }}
{{- end -}}

Your existing site uses the .Data.Pages collection, which, in the current version of Hugo, appears to be limited to content (.IsPage = true), and does not include lists (.IsNode = true).

When we change includeListPagesInTaxonomyLists in config.toml to true, we’re using the site-level page collection (content and lists), limited to those pages with the selected taxonomy term.

If you test this site with Hugo 0.55, you get the same (desired) results whether includeListPagesInTaxonomyLists is true or false, replicating your experience.

Self Reference

I was curious what would happen if I assigned the tag “tag1” to content/tags/tag1/_index.md. It works as expected; content/tags/tag1/_index.md is displayed when viewing http://localhost:1313/tags/tag1/.

Side Note: Taxonomy Configuration

The documentation states:

You need to provide both the plural and singular labels for each taxonomy.

For example:


Your site configuration uses the same label for both singular and plural:

actor = "actor"
character = "character"
director = "director"

This doesn’t appear to affect the behavior of the site in relation to the reported problem, but I found it confusing as I tried to understand your problem and site structure.

Thank you for your time and effort! I’ve downloaded your sample site and seen how the fix works. Now I get to transfer that information to my site.

Very appreciated!