Using cascade to set default params for posts in a specific category

I’m trying to set a default parameter for all posts with a specific category using cascade in my front matter, but it doesn’t seem to be working as I expected.
in my content/categories/funstuff/_index.md i have:

+++
[cascade]
    banner = "funstuff.jpg"
+++

But that parameter is only available to category list pages and category single pages, and not on the post pages themselves. Is there a better place to set defaults like this?

Essentially, I’d like to use that parameter on any posts in that specific category instead of setting a banner value in the front matter manually for each one.

Either as template logic or derived from post front matter.

Presuming you’ve kept each post in a single category, you can access the taxonomy front matter via templates: Taxonomy templates | Hugo

Taxonomies is a many to many relation, so what you want isn’t possible. You can put cascade on your sections or your home page, and that will … cascade down to your pages.

3 Likes