I’m having trouble figuring out why using a string literal works here:
{{ range .content.Site.Pages }}
{{ partial "mappers/item-mapper-entries.html" . }}
{{ end }}
but using a variable with the same value doesn’t:
{{ $partialName := delimit (slice "mappers/item-mapper-" .resourceType ".html") "" }}
{{ range .content.Site.Pages }}
{{ partial $partialName . }}
{{ end }}
In the latter case I get the “template missing or incomplete” error. When I ask for just the value of partialName
, it seems correct:
partial name is: {{ $partialName }}
// mappers/item-mapper-entries.html
Am I missing something frightfully obvious about the way the variables are closed over on a range?