mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
tpl: fix default function
This commit fixes a few things: 1. `given` is now a variadic parameter so that piping works properly 2. add separate template tests to make sure piping works 3. support time values 4. add more tests of the dfault function
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
0743646f32
commit
09c8c17bf0
@@ -37,7 +37,7 @@ non-nil for any other types.
|
||||
e.g.
|
||||
|
||||
{{ index .Params "font" | default "Roboto" }} → default is "Roboto"
|
||||
{{ default "Roboto" .Params.font }} → default is "Roboto"
|
||||
{{ default "Roboto" (index .Params "font") }} → default is "Roboto"
|
||||
|
||||
### delimit
|
||||
Loops through any array, slice or map and returns a string of all the values separated by the delimiter. There is an optional third parameter that lets you choose a different delimiter to go between the last two values.
|
||||
|
Reference in New Issue
Block a user