{{- range $dest, $title := (.Store.Get "all_sources") -}}
{{ $title }}, {{ $dest }}
{{ end }}
While this:
{{- range $permalink, $srcset, $sizes := (.Store.Get "preload_list") -}}
{{end}}
is considered "too many declarations in range ?? There are three variables, because preloast-list has three components. The exact same structure as the first code ({{ .Page.Store.SetInMap "all_sources" .Destination (default .Text .Title) }}) except with one more component.
.Destination is a key and the rest is its value ?
In that case it sucks, because the solution that worked with all_sources can’t work here.
What I need, is to store sets of three values (if possible in a dict) in the same page-wide variable.
I tried the equivalent of
But .Add is interpreted as the numerical method. Probably.
template: home/_markup/render-image.html:61:9: executing “partials/ImagePartial” at <.Page.Store.Add>: error calling Add: can’t apply the operator to the values
The range accepts declarations no more than 2, and none of the decalrations represent the element’s member. So you should tweak the code as follows (similar) in your case.
But I don’t need “foo” or “bar”, can’t I just stack the dict value one on top of the others ?
what’s wrong with {{ .Page.Store.Add "preload-list" (dict "srcset" (delimit $src , ) "permalink" $medium.RelPermalink "sizes" $sizes) }} ?
Oh, slice with the add method ! that’s what I forgot ! thanks !
Yes, all is documented… but not completely, not all use cases, and even if they are, the syntax is so awkward that it’s not always easy to read the sentences without feeling the conjunctivitis arriving.
Now I have one last problem…
with this line:
and merely one images having the loading=eager attribute, and ALL the images of the page get their preload link tag. All 24 of them. Store or Scratch don’t make any difference.