hugo/docs/content/functions/cond.md
2018-01-31 11:08:08 +01:00

561 B

title date description categories menu signature aliases hugoversion relatedfuncs toc draft needsexamples
cond 2017-09-08 Return one of two arguments, depending on the value of a third argument.
functions
docs
parent
functions
cond CONTROL VAR1 VAR2
/functions/cond/
0.27
default
false false false

cond returns VAR1 if CONTROL is true, or VAR2 if it is not.

Example:

{{ cond (eq (len $geese) 1) "goose" "geese" }}

Would emit "goose" if the $geese array has exactly 1 item, or "geese" otherwise.