Execute renders a parsed Go template using one data value and writes the result to a destination. In an HTTP handler, that destination can be an http.ResponseWriter. Parse the template first, then check the error returned by Execute. section 11.1.2
Render a single value
Parse an embedded page with `tpl, err := template.New("index").Parse(indexPage)`. After checking `err`, call `err = tpl.Execute(w, 5)` and check it again. The template action `{{.}}` receives `5` as its value; other template content is rendered around it. section 11.1.2
Execute accepts one data value. To expose several values, pass a map: `tpl.Execute(w, map[string]interface{}{"Habits": habits, "Date": week})`. The map becomes the template’s dot, so actions can access `{{.Habits}}` and `{{.Date.Start}}`. Inside `{{with .Date}}`, the dot becomes the date value and `{{.Start}}` suffices; a `range` over habits must now start from `.Habits`. section 11.5.1
Choose `html/template` when rendering HTML: it escapes HTML-sensitive input. `text/template` has the same interface for output that does not need that protection. When several template definitions are loaded, use ExecuteTemplate and name the root template rather than relying on Execute. section 11.1.2 section 11.6
