Per-page output format setting for a taxonomy term isn't considered

Hi everybody.

I am trying to set up per-page output format for a taxonomy term page according to the documentation I found here: Custom output formats | Hugo.

I set up a simple example site over at GitHub.

It provides

  • two categories “foo” and “bar”
  • alongside two posts “Post #1” (category: “foo”) and “Post #2” (category: “bar”).

For category “foo”, only html output should be applied.
For category “bar”, the outputs html and json should be applied.

The latter was configured by using the following YAML front matter at content/categories/bar/

  - html
  - json

For demonstration purposes, the index page of the example site uses static links to the HTML and JSON representations of both categories.

I expected Hugo to render

  • “Page not found” for the link of /categories/foo/index.json, and
  • a JSON representation for the link of /categories/bar/index.json.

But suddenly, this stopped working and Hugo renders a “Page not found” for the link of /categories/bar/index.json, too.

It looks like a workaround is necessary by:

  • configuring site-level outputs configuration for the term Kind
  • set the list of allowed outputs of the term “bar” to ['html', 'json'].
  • set the list of allowed outputs of the term “foo” to ['html'].

The adjusted configuration can be found in branch “workaround-configuration” of the same GitHub project.

I once got that up and running, without the workaround, with help of topics I found in this forum.
Am I getting this right?
Do I missed something since the latest Hugo updates?

My Hugo environment looks the following:

22:07 $ hugo env
hugo v0.124.0-629f84e8edfb0b1b743c3942cd039da1d99812b0+extended darwin/amd64 BuildDate=2024-03-16T15:44:32Z VendorInfo=brew

Thanks in advance for your help and feedback,

This bug was fixed with, available in the next release.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.