Generating section-specific feeds in site root with v0.146.0+ template system

Hello!

Before Hugo 0.146.0 (and its accompanying new template system) was released, I was able to generate section-specific Atom and JSON feeds in my site root, using section list layouts and the following configuration:

Relevant part of config.toml:

[mediaTypes."application/atom+xml"]
  suffixes = ["xml"]
[outputFormats.atomfeed]
  mediaType = "application/atom+xml"
  baseName = "feed"
  isPlainText = true
[outputFormats.jsonfeed]
  mediaType = "application/json"
  baseName = "feed"
  isPlainText = true
[outputs]
  home = ["html"]
  section = ["html", "atomfeed", "jsonfeed"]

I also had corresponding section-specific list layouts defined as layouts/section/list.atomfeed.xml and layouts/section/list.jsonfeed.json.

With seemingly no other relevant configuration, this would cause Hugo to generate section-specific Atom and JSON feed files in the site root (a pair for each section), automatically named /some_section.json, /some_section.xml, /another_section.json, /another_section.xml, etc. This is my desired behavior.


Post-0.146.0, I can’t figure out how to change my configuration/layouts to replicate this behavior. I was able to get as far as generating /some_section/feed.xml and /some_section/feed.json, but not /some_section.xml and /some_section.json in the site root as they appeared previously.

Per my interpretation of the documentation, I moved layouts/section/list.atomfeed.xml and layouts/section/list.jsonfeed.json to layouts/list.section.atomfeed.xml and layouts/list.section.jsonfeed.json respectively. The relevant parts of my config.toml are unchanged from the above.

I tried setting root = true and path = "/" for the relevant outputFormats in config.toml, but neither of these seemed to have any effect.

How can I configure/instruct Hugo to render section-specific lists in the site root, as it was doing for me before 0.146.0?

(EDIT: I now see that the same behavior also applies to section-specific HTML list pages; Hugo used to generate /some_section.html but now instead generates /some_section/index.html. Again, the former is my desired behavior.)

What version are you testing with?

hugo v0.148.1+extended+withdeploy darwin/arm64 BuildDate=2025-07-11T12:56:21Z VendorInfo=brew

https://discourse.gohugo.io/t/breaking-changes-in-v0-148-0/55257

Ah I see! I had assumed I migrated my template configuration incorrectly for 0.146.0.

I am indeed using top-level uglyurls = true. The page you linked just shows that this is a breaking change in 0.148.0, with no workaround or way to return to the previous behavior to prevent URLs from being broken/pages from moving? Is that correct?

Since those three issues were clearly bugs, I haven’t put any thought into how to continue doing what you were doing. I’ll think about it.

Understood, Hyrum’s Law strikes again!

I mostly wanted to avoid breaking existing list page/feed URLs, but this is a nice-to-have; specific content page URLs are unaffected and are much more important to not break.

I will use an earlier version of Hugo in the meantime.

If it were me, I would create server-side redirects presuming that is supported by your hosting setup.

Yup, this is one possible solution I thought of, and I can certainly do this. Thanks!

1 Like

all observable behaviors of your system
will be depended on by somebody

The above is not directed at you. It’s just a contrived example of Hyrum’s Law.

2 Likes

Yup, it’s a classic! :grinning_face_with_smiling_eyes:

1 Like