HUGO
News Docs Themes Community GitHub

or

Returns the first truthy argument. If all arguments are falsy, returns the last argument.

Syntax

or VALUE...

Returns

any

The falsy values are false, 0, any nil pointer or interface value, any array, slice, map, or string of length zero, and zero time.Time values.

Everything else is truthy.

{{ or 0 1 2 }} → 1
{{ or false "a" 1 }} → a
{{ or 0 true "a" }} → true

{{ or false "" 0 }} → 0
{{ or 0 "" false }} → false

See Go’s text/template documentation for more information.