instant.page
load page faster via preloading
Tocbot
automatically generate toc for page
How to Learn Go and Hugo
This is the Go Template language (also called Go HTML Template), which is used by Hugo as its templating system. Hugo is a static site generator built in Go, and it uses Go’s templating engine with some additional Hugo-specific functions and variables.
- Hugo’s Official Template Documentation:
- Go Language:
Key Syntax Elements
The template language you’re seeing uses these distinctive elements:
{{ }}- Template directives{{- }}and{{- -}}- Whitespace-trimmed directives.- The current context$varName- Custom variables (like$count)range- Iteration over collectionsif/else/end- Conditional logicwith- Context switching|- Pipeline operator (used to chain functions)
Learning Path
- Start with Hugo’s Template Basics: Begin with Hugo’s template documentation to understand the basics of how templates work in Hugo.
- Learn Hugo-specific functions and variables: Hugo adds many custom functions like
.Permalink,.Pages, and variables likesite.Params. - Understand Hugo’s Template Hierarchy: Hugo uses a specific lookup order for templates, which is important to know for overriding theme templates.
- Explore Go’s Template Syntax: For deeper understanding, learn about the underlying Go template language.
- Hugo server with the
--verboseflag to see error messages
If And, if or
{{ if and (conditional1) (conditional2) }}
{{ if or (conditional1) (conditional2) }}