Hi Guys,
I need a little help with setting a custom variable conditional. My current code isn’t working (think it’s related to go template scoping issues?).
Found https://gohugo.io/functions/scratch/ in the documentation. But I can’t get it to work right with structure of $custom or $default
.
All help is welcome. Cheers
{{ if (or (.Params.hero.show) (.Params.defaults.hero) ) }}
{{ $custom := .Params.hero }}
{{ $default := .Site.Data.defaults.hero }}
{{ $custom }}
{{ $default }}
{{ if .Params.hero.show }}
{{ $hero := $custom }}
{{ end }}
{{ if .Params.defaults.hero }}
{{ $hero := $default }}
{{ end }}
<!--- template code -->
{{ end }}
Structure of $custom or $default
map[img:/img/hero.jpg size:medium text:Test ticker:true show:false]