O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the templates for the products listing page

Let's examine the products_page.tmpl source file found in the shared/templates directory:

{{ define "pagecontent" }}{{template "products_content" . }}{{end}}{{template "layouts/webpage_layout" . }}

This is the page template for the products listing page. The primary purpose of this template is to render the contents of the products_content template and place it inside of the web page layout.

Let's examine the products_content.tmpl source file found in the shared/templates directory:

<h1>Products</h1><div id="productsContainer">  {{if .Products}}  {{range .Products}}  <div class="productCard">    <a href="{{.Route}}">    <div class="pricebox"><span>${{.Price}}</span></div> <div class="productCardImageContainer"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required