<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Golang on Slick Example</title><link>/categories/golang/</link><description>Recent content in Golang 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 23:42:05 +0100</lastBuildDate><atom:link href="/categories/golang/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><item><title>Getting Started with Hugo</title><link>/posts/hugoisforlovers/</link><pubDate>Wed, 02 Apr 2014 23:42:05 +0100</pubDate><author>mail@example.org (Some Author)</author><guid isPermaLink="true">/posts/hugoisforlovers/</guid><description>&lt;h2 id="step-1-install-hugo"&gt;Step 1. Install Hugo&lt;/h2&gt;
&lt;p&gt;Go to &lt;a href="https://github.com/spf13/hugo/releases"&gt;Hugo releases&lt;/a&gt; and download the
appropriate version for your OS and architecture.&lt;/p&gt;
&lt;p&gt;Save it somewhere specific as we will be using it in the next step.&lt;/p&gt;
&lt;p&gt;More complete instructions are available at &lt;a href="https://gohugo.io/getting-started/installing/"&gt;Install Hugo&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="step-2-build-the-docs"&gt;Step 2. Build the Docs&lt;/h2&gt;
&lt;p&gt;Hugo has its own example site which happens to also be the documentation site
you are reading right now.&lt;/p&gt;
&lt;p&gt;Follow the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Clone the &lt;a href="https://github.com/spf13/hugo"&gt;Hugo repository&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Go into the repo&lt;/li&gt;
&lt;li&gt;Run hugo in server mode and build the docs&lt;/li&gt;
&lt;li&gt;Open your browser to http://localhost:1313&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Corresponding pseudo commands:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git clone https://github.com/spf13/hugo
cd hugo
/path/to/where/you/installed/hugo server --source=./docs
&amp;gt; 29 pages created
&amp;gt; 0 tags index created
&amp;gt; in 27 ms
&amp;gt; Web Server is available at http://localhost:1313
&amp;gt; Press ctrl+c to stop
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once you&amp;rsquo;ve gotten here, follow along the rest of this page on your local build.&lt;/p&gt;
&lt;h2 id="step-3-change-the-docs-site"&gt;Step 3. Change the docs site&lt;/h2&gt;
&lt;p&gt;Stop the Hugo process by hitting Ctrl+C.&lt;/p&gt;</description></item></channel></rss>