In web programming, a web template is a text document that describes the format in which a web page should appear to the user. In this book, we will focus on web templates from Go's html/template package—the package that implements data-driven templates suitable for use in web applications.
Web templates (we'll refer to them simply as templates moving forward) are text documents, that are typically implemented in HTML, and may contain special commands that are embedded inside of them. In Go, we refer to these commands as actions. We denote actions in templates by placing them inside a pair of opening and closing double curly braces—{{ and }}.
Templates form the means to present data to the user in a manner that is intuitive and acceptable. In fact, you can think of a template as the means by which we dress up data.
Templates are used in conjunction with a web template system. In Go, we have the robust html/template package from the standard library to render templates. When we use the term render template, we refer to the process by which one or more templates, along with a data object, is processed through a template engine that generates HTML web page output, as depicted in Figure 4.1:
The key components in Figure 4.1, the template engine, the template data object, and the templates, can be classified as comprising a web template system. Each component plays an important role toward rendering the web page output, and in the following sections, we'll consider the role that each component plays in this process of producing the HTML output to display in the web browser. In this chapter, we will build IGWEB's About page.