Hugo explained


#1

I found a few great articles about Hugo:

Hugo .Scratch explained

Hugo Template Language

Hugo Page Resources

Tnx to the author @regis


#2

really nice, thanks for the links!


#3

You’re very welcome, thanks for the shoutout!


#4

Great - thx


#5

@regis,

You say:

What about ternary operators, x ? x : y ?

Not in Go you don’t :confused:

Hugo added a cond function for ternary operations in v0.27, but the docs haven’t been merged.


#6

Thanks for the tip @moorereason! Can’t wait to play with it and update the article :wink:


#7

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.


#8

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.


#9

It’s been updated. Thanks again!


Exclude term from being displayed in array