<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Templates on Slick Example</title><link>/tags/templates/</link><description>Recent content in Templates on Slick Example</description><generator>Hugo 0.167.0</generator><language>en</language><managingEditor>mail@example.org (Some Author)</managingEditor><webMaster>mail@example.org (Some Author)</webMaster><copyright>Some Author — All rights reserved.</copyright><lastBuildDate>Wed, 02 Apr 2014 00:00:00 +0000</lastBuildDate><atom:link href="/tags/templates/index.xml" rel="self" type="application/rss+xml"/><item><title>(Hu)go Template Primer</title><link>/posts/goisforlovers/</link><pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate><author>hugo@example.net (Hugo)</author><guid isPermaLink="true">/posts/goisforlovers/</guid><description>&lt;p&gt;Hugo uses the excellent [Go][] [html/template][gohtmltemplate] library for
its template engine. It is an extremely lightweight engine that provides a very
small amount of logic. In our experience that it is just the right amount of
logic to be able to create a good static website. If you have used other
template systems from different languages or frameworks you will find a lot of
similarities in Go templates.&lt;/p&gt;
&lt;p&gt;This document is a brief primer on using Go templates. The [Go docs][gohtmltemplate]
provide more details.&lt;/p&gt;
&lt;h2 id="introduction-to-go-templates"&gt;Introduction to Go Templates&lt;/h2&gt;
&lt;p&gt;Go templates provide an extremely simple template language. It adheres to the
belief that only the most basic of logic belongs in the template or view layer.
One consequence of this simplicity is that Go templates parse very quickly.&lt;/p&gt;
&lt;p&gt;A unique characteristic of Go templates is they are content aware. Variables and
content will be sanitized depending on the context of where they are used. More
details can be found in the [Go docs][gohtmltemplate].&lt;/p&gt;
&lt;h2 id="basic-syntax"&gt;Basic Syntax&lt;/h2&gt;
&lt;p&gt;Golang templates are HTML files with the addition of variables and
functions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Go variables and functions are accessible within {{ }}&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Accessing a predefined variable &amp;ldquo;foo&amp;rdquo;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{{ foo }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Parameters are separated using spaces&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Calling the add function with input of 1, 2:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
&lt;/code&gt;&lt;/pre&gt;</description></item></channel></rss>