Direct access to taxonomy term params?

There are many cases where we have to access taxonomy term parameters in non-taxonomy templates.

Usually, we treat taxonomies as pages with getpage to do that.
Is there any other way to access directly taxonomy term params?


Not that I know of, the .GetPage function would be the way I would do it.

1 Like

GetPage does not work if we have
disableKinds: [“taxonomy”,“taxonomyTerm”] at config.yaml

So, we’d better have another way.

Of course, if you are disabling the taxonomies you won’t be able to access tags because they are a taxonomy type.

So, actually there is no other way, right?
This could be a feature request. Right?

As @brunoamaral mentioned, you are asking conflicting things.
No need for a feature request, as the feature is already there, but you have it disabled.

1 Like

I mean a feature request could be another way to do it as I already mention.
More direct without the need of producing html pages for taxonomies in order to retrieve their data.

I need categories and their results in a single page.
I do not need though extra pages to be created.


Actually what you are asking is possible with an old hack that predates the development of disableKinds in Hugo.

First of all I recommend that you familiarize yourself with Hugo’s lookup order for taxonomy list pages

Then remove the disableKinds parameter from your project’s configuration.

Based on your sample repo that you posted over here under /layouts/ create a directory called categories and then within this directory create an empty file called list.html

The empty list template for categories will disable the generation of all list pages for this taxonomy, but at the same time you will still be able to access the taxonomy terms as described in my post in your other topic.

Note that whenever you execute hugo server locally the disabled taxonomy list pages will show up as empty white pages in the browser, but when the site is deployed online these pages will throw a 404.

As I said above this is an old hack. It’s been there since at least 2015.

Usually we do not prescribe hacks since we don’t know if/when they might be disabled.

Still for the scenario you described this is the only way to achieve what you want and I have been using this hack myself in at least one project of mine without any issues.


Thanks for the hack. It works.

Do you mean that in a future version of hugo it may not work?

That I do not know.