So I’m trying to reduce the number of IF/ELSE statements. Is there a way I can incorporate an OR conditional inside an IF statement to check if either param A or param B is set?
This obviously doesn’t work, but kinda what I am after
---
media:
image:
svg: this is set
---
{{ with .media }}
{{if ( or ( .image ) ( .svg )) }}
<div class="media">
{{.image}}
{{.svg}}
</div>
{{end}}
{{end}}
Ideally I’m looking for something that’s more readable without having multiple IF statements just to check if some parameters with the same context are there.
I’ve tried using a variation of not (eq .image "") | or (eq .svg "") and isset but I keep getting an error of wrong number of args for safeHTML: want 1 got 0.
Is it possible to use an OR conditional for this purpose?