{"body_class":"rp-body rp-section- rp-full-js","section":"project","thisUrl":"https://regisphilibert.com/tags/go/","title":"Regis Philibert | Go","translation_url":null}


Hugo Translator

Go Template is the templating language used by Hugo and other Go systems. Now it is not Twig or Blade or Liquid, don’t get fooled by the familiar curlies. It is a far stretch from those well known Templating Language out there…

{{ printf "Hello %s %s. %s" $firstname (slicestr $middlename 0 1) $lastname }}

What is this 😨

{{ if or (eq firstname 'George') (eq firstname 'Daniel') }}

or that ? 😱

The first time you’re gonna stumble on the syntax above may be a bit deconcerting if you come from more conventional languages.

I spent a lot a time trying to figure out how best to use Go Template.

Using comparison with more familiar syntaxes, I wrote this modest article to try and help unveil the misteries of Go Template

Read more ...