When several pages share HTML, keep the repeated markup in a subtemplate rather than copying it into every page. A parent template includes that subtemplate when it renders. section 9.1.5
Listing 9.8 Index template including head template
<!DOCTYPE HTML>
<html>
{{template "head.html" .}} #1
<body>
<h1>{{.Title}}</h1>
<p>{{.Content}}</p>
</body>
</html>
The index template replaces its head markup with {{template "head.html" .}}. The final dot passes the parent’s data to the included template. section 9.1.5
Render a page with a shared head
Put the head markup in head.html, where {{.Title}} can use the page’s title. Parse both files with template.ParseFiles("index.html", "head.html"), then render with ExecuteTemplate(w, "index.html", page). section 9.1.5
