runhide
1
Is there a way to simplify the following code and not repeat append
multiple times?
{{range .Params.a | append .Params.b | append .Params.c | append .Params.d}}
{{.}}
{{end}}
I’ve tried countless alternatives, but this is the only version that I’ve got to work. Thanks.
zwbetz
2
Written from phone so is terse. Try something like:
{{ $foo := slice .Params.a .Params.b }}
{{ range $foo }}
2 Likes
bep
3
That is different from what @runhide posted, but probably what he wanted.
An altnerate approach would be:
{{ $keys := slice "a" "b" "c" }}
{{ range $keys }}
{{ range (index $.Params .) }}
{{ . }}
{{ end }}
{{ end }}
3 Likes