Using one Taxonomy for Multiple Purposes


I am investigating the use of Hugo for a corporate documentation site. One of the things I’d like to do is link a piece of content to the same Taxonomy multiple times.

For example, I have a Taxonomy for Departments. I then have a section of my site with pages for each of the various Systems deployed within the organisation. I’d like to link the content for a particular system to a list of Departments who use the system, another list of Departments who control the data within the system, etc.

From the Department taxonomy term pages, I’m quite happy just to see a list of the Systems that the Department is related to (regardless of the “reason”). However, on the Systems page I’d like to be able to show multiple distinct lists of Departments, one for each “reason” - Users, Data Controllers, etc.

Is this possible? If anybody could give me some pointers as to how to set this up, I’d really appreciate it.


Just to add to this…

I did consider having a Taxonomy called “Users” and another called “Data Controllers” - the problem is that I’d want the list of available Terms to be the same (as the Term pages will themselves have content on them).

You cannot accomplish this with the taxonomy system. Instead, create two content types (departments and systems) and relate each system to one or more departments using frontmatter parameters.

Here’s an example:

git clone --single-branch -b hugo-forum-topic-33768 hugo-forum-topic-33768
cd hugo-forum-topic-33768
hugo server

Wow - I don’t know what to say! That’s one hell of a response! Not only a solution, but a complete working example!

That’s great - thank you! :smiley:

This is certainly the route I’ll go down. One of the things I was hoping to achieve through the use of Taxonomies was not needing to track where the relationships were happening…

For example, if in the future we add a third way of associating a system with a department, we need to update both the Department pages, and the System pages.

But - that’s very much a “nice to have” and your solution will certainly fit our needs very well.

Thanks again!

I’ve updated the repository to abstract hard-coded portions of the template logic into the site configuration.

Let’s say you wanted to add a third way of associating a system with a department: maintainers.

Step 1: Modify the site configuration

  label_for_system_pages = "Data controllers"
  label_for_department_pages = "Systems where the data is controlled by this department"
  label_for_system_pages = "Users"
  label_for_department_pages = "Systems used by this department"
  label_for_system_pages = "Maintainers"
  label_for_department_pages = "Systems maintained by this department"

Step 2: Modify the frontmatter of the system page

  users = ["department-1", "department-2","department-3"]
  data_controllers = ["department-1","department-2"]
  maintainers = ["department-1","department-3"]