Reading the docs wasn't particularly helpful and I want to know if the structure
{{header}}
{{content that always changes}}
{{footer}}
is achievable with golang.
Using text/template:
Code to render it to Stdout
t := template.Must(template.ParseFiles("main.tmpl", "head.tmpl", "foot.tmpl"))
t.Execute(os.Stdout, nil)
main.tmpl:
{{template "header" .}}
<p>main content</p>
{{template "footer" .}}
foot.tmpl:
{{define "footer"}}
<footer>This is the foot</footer>
{{end}}
head.tmpl:
{{define "header"}}
<header>This is the head</header>
{{end}}
This will result in:
<header>This is the head</header>
<p>main content</p>
<footer>This is the foot</footer>
Using html/template will be extremely similar.