How to show taxonomy terms for the _index.html pages?

I am creating a website project that has online courses and blog posts.
It has two sections - courses and blogs.
The directory structure looks something like this:

    |              |_______post-1
    |              |              |_______''
    |              |_______post-2
    |                             |_______''
                   |              |_______ ''
                   |              |_______chapter
                   |                             |_______''
                   |                             |_______''
                                  |_______ ''

The blog section is absolutely fine.
The course section, however has nested branch bundles. This was required as each course would have its own landing page ( and may have multiple chapters (, etc) in that course.
I created a separate layout for the course section to display the course landing page and the chapters.
The categories under which each course falls are defined in the front matter of the ‘’ file present directly under the course directory.

The problem
With this setup the navigation between the courses is now easy. However, the default taxonomy aggregation no longer works.
That is, the ‘/categories’ page is now blank.

If I change the structure of the Course Page Bundles from Branch to Leaf (that is if I change to under the individual course), then the ‘/categories’ page works fine and picks up the categories taxonomy from the front matter of the of the course. But then, I am no longer allowed to nest it further to include chapters within the course directory.

It looks like the taxonomies are collected only from the regular pages and not the section pages.

I thought about creating a layout for ‘categories.terms.html’ to overcome this, where I can loop through the $.Site.Sections to collect the information and display them. But then, the user may want to click a category and I would also need to create the page that would display the courses tagged with that category. I am not sure how to do this?
For example, if my ‘/categories’ page show 3 categories - ‘music’, ‘fine-arts’ and ‘dancing’
The user may want to click on ‘music’ category that should take the user to ‘/categories/music’
I am not sure how to create this layout?

Also, it seems to me that I may be complicating things a bit and maybe doing something wrong somewhere. Maybe Hugo has a better in-built solution to the problem I am trying to solve.

I would appreciate if someone could suggest a way around this.

A sample source code for the “Learning” website with the theme I am developing could be found at
The theme itself is at

Hugo version: v0.62.2-83E50184 windows/amd64 BuildDate: 2020-01-05T18:53:21Z