Hugo Static Site Generator v0.20.7 darwin/amd64 BuildDate: 2017-05-11T23:05:23-04:00
Take the following partial:
{{ $tags := $.Site.Taxonomies.tags.ByCount }}
{{ $v1 := where $tags "Count" ">=" 3 }}
{{ range $v1 }}
//stuff
{{ end }}
This works fine when I use a regular partial passing through the page context, like {{ partial "tags.html" . }}
But when I try to pass through variables using dict
, like this:
{{ partial "tags.html" (dict "context" . "tagCount" "3") }}
I get an error:
error calling partial: template: partials/tags.html:3:10: executing "partials/tags.html" at <where $tags "Count" ...>: error calling where: can't iterate over <nil>
As you can see, I don’t even know where to use context.
but this is what I’m trying accomplish and haven’t gotten to yet: to change the “Count” in the $v1
v where statement from where I’m calling the partial.