I found a few great articles about Hugo:
Tnx to the author @regis
I found a few great articles about Hugo:
Tnx to the author @regis
really nice, thanks for the links!
You’re very welcome, thanks for the shoutout!
Great - thx
What about ternary operators, x ? x : y ?
Not in Go you don’t
Hugo added a cond
function for ternary operations in v0.27, but the docs haven’t been merged.
Thanks for the tip @moorereason! Can’t wait to play with it and update the article
Any Lisp fans out there?
Being familiar with Lisp, I found the Go Templates syntax very intuitive… the idea is simple… (FN ARG1 ARG2 .. ARGN)
… it doesn’t matter what function it is… the function keyword always comes first. And that translates in Go Templates as {{ FN ARG1 ARG2 .. ARGN }}
.
If not lisp, but familiar with RPN calculators, then too, it’s the same idea… (+ 1 2)
instead of 1 + 2
.
The beauty in the Go templates comes when you pipe stuff with “|”. I think that is Rob Pike’s construct. Sadly we have many template funcs that has a “less than optimal” argument order, which is hard to fix without breakage.