I’m trying to pass a varibale for header height to a partial with an if statement
{{ $header := $.Params.options.header }}
<div class="wrapper">
{{ if ne $header nil }}
{{ if or (eq $header "mini") (eq $header "small") }}
{{ partial "header-small.html" (dict "context" . "headersize" $header) }} }}
{{ end }}
{{ if eq $.Params.options.header "full" }}
{{ partial "header-full.html" . }}
{{ end }}
{{ else }}
{{ partial "header-small.html" (dict "context" . "headersize" "small") }}
{{ end }}
Then, in the header I use the following
<div class="page-header page-header-{{ printf "%" .headersize }}">
I checked the forum and this solution has been applied by others, but I am getting an error in the header-small.html partial:
error calling partial: “/Users/brunoamaral/Labs/Digital-Insanity/themes/now-ui/layouts/partials/header-small.html:1:50”: execute of template failed: template: partials/header-small.html:1:50: executing “partials/header-small.html” at <.headersize>: can’t evaluate field headersize in type *hugolib.pageState
What am I missing?