For some purposes, it is not necessary to create highly dynamic web UI with all the JavaScript, and the static content with generated content could be sufficient. The Go standard library provides a way of constructing dynamically generated content. This recipe gives a lead into the Go standard library templating.
Serving content generated with templates
How to do it...
- Open the console and create the folder chapter09/recipe08.
- Navigate to the directory.
- Create the file template.tpl with the following content:
<html>
<body>
Hi, I'm HTML body for index.html!
</body>
</html>
- Create the file dynamic.go with the following content:
package main
...