Chapter 5.
Dynamic HTML templates
In this section of the book we’re going to concentrate on displaying the dynamic data from our MySQL database in some proper HTML pages.
You’ll learn how to:
- Pass dynamic data to your HTML templates in a simple, scalable and type-safe way.
- Use the various actions and functions in Go’s
html/template
package to control the display of dynamic data. - Create a template cache so that your templates aren’t being read from disk and parsed for each HTTP request.
- Gracefully handle template rendering errors at runtime.
- Implement a pattern for passing common dynamic data to your web pages without repeating code.
- Create your own custom functions to format and display data in your HTML templates.