Ideally i’m after something like:
{{ range where .Pages len(".Params.stuff") ">" 0 OR len(".Params.stuff2") ">" 0 }}
Is it possible?
Otherwise I’m dealing with nested if statement, which isn’t as beautiful as I’d like.
Thanks.
Ideally i’m after something like:
{{ range where .Pages len(".Params.stuff") ">" 0 OR len(".Params.stuff2") ">" 0 }}
Is it possible?
Otherwise I’m dealing with nested if statement, which isn’t as beautiful as I’d like.
Thanks.
@mr-moon Try something like this:
{{ range .Pages }}
{{ if or (gt (len .Params.stuff) 0) (gt (len .Params.stuff2) 0) }}
{{ . }}
{{ end }}
{{ end }}
I suspect something like this wold work
{{ $pages := where ".Params.stuff" "!=" nil }}
{{ $pages = $pages | union (where ".Params.stuff2" "!=" nil) }}
{{ range $pages ...
Thanks. Both work great.