I can’t figure out what I’m doing wrong, but if I move the same template code to a partial and include it back into the original file, it seems that the partial doesn’t have access to any variables.
E.g. if I have this in a template it works fine:
<title>{{ .Title }} | {{ .Section }} | {{ .Site.Title }}</title>
But if I move that into a partial and replace it with {{ partial "header.html" }}
, then those three variables all become empty. The partial is definitely found and included as the general markup in it appears, but the variables all seem to be empty.
What should I be doing to get variables in partials?