The page template for the about page

Here's an example of the page template for the About page, from the about_page.tmpl source file in the shared/templates folder:

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

We use the define action in the page template, to define the region of the template that contains the template section that we have declared as the pagecontent section. We have a corresponding end action to mark the end of the pagecontent section. Notice that we have a template action in between the define and end actions to include the template named about_content. Also note that we provide the dot (.) action to pass the data object to the about_content template.

This page template is a good example that shows how we can render layout templates inside of a regular template. In the last line of the template, we declare a template action to load the layout template for the web page that is named layouts/webpage_layout. Again, notice that we provide the dot (.) action to pass the data object to the web page layout template.

Now that we've examined the about_page template, it's time to examine the about_content template.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.158.165