cond
少于1分钟
将以下英文翻译为中文:
cond
https://gohugo.io/functions/cond/
Return one of two arguments, depending on the value of a third argument.
语法
cond CONTROL VAR1 VAR2
cond returns VAR1 if CONTROL is true, or VAR2 if it is not.
Example:
| |
Would emit “goose” if the $geese array has exactly 1 item, or “geese” otherwise.
Whenever you use a cond function, both variable expressions are always evaluated. This means that a usage like cond false (div 1 0) 27 will throw an error because div 1 0 will be evaluated even though the condition is false.
In other words, the cond function does not provide short-circuit evaluation and does not work like a normal ternary operator that will pass over the first expression if the condition returns false.
最后修改 June 1, 2023: 新增一个配置参数:sidebar_menu_truncate = 500 用于解决菜单不全的问题 (27810f1)