I come across this library when I started to use Hugo, which says:

It is an extremely lightweight engine that provides a very small amount of logic. In our experience it is just the right amount of logic to be able to create a good static website.

3 Steps Using The Template Object

  1. New an template object.

  2. Parse template text.

  3. Execute (apply) the template to data structure.

6 Action Families


{{/* comment here, line spanning allowed */}}

pipeline like variable expansion (substitution)


if family for branching logic

{{if _pipline_}} T1 {{end}}
{{if _pipline_}} T1 {{else}} T0 {{end}}
{{if _pipline_}} T1 {{else if _pipeline_ }} T0 {{end}}

range family for iteration (loop)

{{range pipepine}} T1 {{end}}
{{range pipepine}} T1 {{else}} T0 {{end}}

with family for cursor (dot) moving

{{with pipeline}} T1 {{end}}
{{with pipeline}} T1 {{else}} T0 {{end}}

template family for tempates invocation

// with the dot '.' set to nil.
{{tempalte "name"}}
// with the dot '.' set to value of 'pipeline'.
{{tempalte "name" pipeline}}

Argument Types

(.Field.Key.Method args...).Field.Key ...
print (func arg...) (.method arg...)