hugo-now-ui icon indicating copy to clipboard operation
hugo-now-ui copied to clipboard

Problem using parameters (e.g. for tint or background image)

Open adamjack opened this issue 5 years ago • 0 comments

I am new to and using "Hugo Static Site Generator v0.55.6/extended darwin/amd64 BuildDate: unknown" using "go version go1.12.6 darwin/amd64" and with your theme. Thanks for the great work. It is good to be able to have bootstrap 4 in the mix allowing me to use those components within the markdown.

I decided to try to change the background image and I set both:

[params] background = "/images/...

and in front matter:

background: '/images/...

but neither seemed to override the img/header.jpg default. Similar results when I attempt to change tint.

In order to try to learn I started adding {{ .Params }} into templates to view params and I saw the values there, and (out of desperation) I deleted the default ... and suddenly things worked as I expected.

Could I have a version mismatch somehow? I'm not yet strong enough on "go" to understand if there might be a hugo, a golang templates or (longest shot) a golang mismatch, but (for me) this template code doesn't seem to work as intended. Or ... am I doing something incorrectly?

Thanks in advance for any thoughts.

--- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -8,16 +8,16 @@ <div class="{{ .Params.wrapper | default "wrapper" }}">

     <div class="page-header {{ .Params.headerstyle | default "page-header-small"}}" filter-color="{{ .Param "tint" | default "orange" }}">
  •        <div class="page-header-image" data-parallax="true" style="background-image: url('{{ (.Param "background")  | (default "img/header.jpg" | absURL) }}');">
    
  •        <div class="page-header-image" data-parallax="true" style="background-image: url('{{ .Param "background" }}');">
           </div>
    

adamjack avatar Oct 28 '19 15:10 adamjack