Cascading images and .Params.banner

Hello,

I read this Allow cascading Front Matter #6041 and then Front Matter Cascade.

My problem is that I don’t know how to invoke .Params.banner within my templates. I assumed I could stick it in theme/cupper-theo/layouts/_default/single.html and then put the cascade: banner: within _index.md of the root of the directory. But the image never came up.

How do you set this up correctly?

Please show a project.

You mean like this: Theologicus
-or-
do you need the repo?

theme/cupper-theo/layouts/_default/single.html

<code>
{{ define "main" }}
  <main id="main">
    <h1>{{ .Title }}</h1>
    {{ .Content }}
  </main>
{{ end }}

</code>

Here is the project: https://github.com/joelouthan/theologicus-public

1 Like

That’s basically it. One note: it’s recommended to do site-specific overrides in your site’s layouts directory (I see you come from WordPress, same idea behind child themes, where you don’t want your changes overridden in a theme update).

I was gonna point out updating your /layouts/_default/single.html template to show the banner, but I’m not finding it in your content directory. Please point me to you _index.md with the banner front matter, and we’ll go from there. :slight_smile:

It in my theme. Should that be in the webroot?

When I put in a _index.md within a subdirectory of posts, I see that those posts no longer shows up in my Recent /posts/. Is that intentional?

I don’t have front matter for cascade/banner. How do you do it in single.html and how do you it for a subdirectory of posts only?

I don’t understand what you are asking. It sounded like you tried adding a banner using front matter cascade, but I can’t see where you tried it. If I can’t see what you tried, I can’t correct it or show a way for it to work.

Sorry I don’t understand, maybe someone else can assist. :slight_smile:

My apologies @maiki and thank you for helping me.

For instance:

  1. I placed an _index.md within:
    content/posts/6-sundry-saturday/_index.md
  2. And I put the cascade/banner within that.
  3. and pointed the banner to the image (that is technically in https://theologic.us/images/)

Two things:

  1. I don’t see a banner for any post within 6-sundry-saturday
  2. And now if you click on Recent to go to /posts/, those 6-sundry-saturday posts do not appear in that list.

You are dealing with two different Hugo “systems”, namely the front matter cascade (as you know), and then also configuring page bundles (https://gohugo.io/content-management/page-bundles/).

I’ll make a note to check your repo this evening and see if I understand a straightforward path for ya.

Any luck?