Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xianmin/hugo-theme-jane.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Xianmin <xianmin12@gmail.com>2018-03-10 16:35:19 +0300
committerChen Xianmin <xianmin12@gmail.com>2018-03-10 16:35:19 +0300
commit339af374b9a9c3e24cee4fd9e59e906b620f4e04 (patch)
tree3ddbb9136800c4d0dc46ef543a0c555cba94c04d
parenta487530e746ac692030681b10e35538d1dab717a (diff)
update
-rw-r--r--404.html6
-rw-r--r--about/index.html6
-rw-r--r--categories/development/index.html14
-rw-r--r--categories/development/index.xml1703
-rw-r--r--categories/english/index.html14
-rw-r--r--categories/english/index.xml1096
-rw-r--r--categories/golang/index.html14
-rw-r--r--categories/golang/index.xml1703
-rw-r--r--categories/index.html6
-rw-r--r--categories/index.xml26
-rw-r--r--categories/index/index.html14
-rw-r--r--categories/index/index.xml3581
-rw-r--r--categories/shortcodes/index.html14
-rw-r--r--categories/shortcodes/index.xml710
-rw-r--r--categories/syntax-highlighting/index.html14
-rw-r--r--categories/syntax-highlighting/index.xml78
-rw-r--r--dist/jane.min.css2
-rw-r--r--dist/jane.min.css.map2
-rw-r--r--dist/jane.min.js.map2
-rw-r--r--index.html30
-rw-r--r--index.xml3599
-rw-r--r--page/2/index.html30
-rw-r--r--post/creating-a-new-theme/index.html6
-rw-r--r--post/english-preview/index.html6
-rw-r--r--post/goisforlovers/index.html6
-rw-r--r--post/hugoisforlovers/index.html6
-rw-r--r--post/index.html14
-rw-r--r--post/index.xml3581
-rw-r--r--post/jane-theme-preview/index.html6
-rw-r--r--post/migrate-from-jekyll/index.html6
-rw-r--r--post/shortcodes-preview/index.html6
-rw-r--r--post/syntax-highlighting/index.html6
-rw-r--r--tags/development/index.html14
-rw-r--r--tags/development/index.xml1703
-rw-r--r--tags/english/index.html14
-rw-r--r--tags/english/index.xml1096
-rw-r--r--tags/go/index.html14
-rw-r--r--tags/go/index.xml1703
-rw-r--r--tags/golang/index.html14
-rw-r--r--tags/golang/index.xml1703
-rw-r--r--tags/hugo/index.html14
-rw-r--r--tags/hugo/index.xml89
-rw-r--r--tags/index.html6
-rw-r--r--tags/index.xml58
-rw-r--r--tags/jekyll/index.html14
-rw-r--r--tags/jekyll/index.xml176
-rw-r--r--tags/preview/index.html14
-rw-r--r--tags/preview/index.xml1880
-rw-r--r--tags/shortcodes/index.html14
-rw-r--r--tags/shortcodes/index.xml710
-rw-r--r--tags/syntax-highlighting/index.html14
-rw-r--r--tags/syntax-highlighting/index.xml78
-rw-r--r--tags/tag-2/index.html14
-rw-r--r--tags/tag-2/index.xml1096
-rw-r--r--tags/tag-5/index.html14
-rw-r--r--tags/tag-5/index.xml78
-rw-r--r--tags/tag-6/index.html14
-rw-r--r--tags/tag-6/index.xml710
-rw-r--r--tags/templates/index.html14
-rw-r--r--tags/templates/index.xml1616
-rw-r--r--tags/themes/index.html14
-rw-r--r--tags/themes/index.xml1616
62 files changed, 30488 insertions, 333 deletions
diff --git a/404.html b/404.html
index 7d41683..c4ecdb1 100644
--- a/404.html
+++ b/404.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="404 Page not found" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -214,5 +217,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/about/index.html b/about/index.html
index 6ffa9f1..cb74e45 100644
--- a/about/index.html
+++ b/about/index.html
@@ -48,6 +48,9 @@ It makes use of a variety of open source projects including:
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="About" />
<meta property="og:description" content="Hugo is a static site engine written in Go.
It makes use of a variety of open source projects including:
@@ -233,5 +236,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/categories/development/index.html b/categories/development/index.html
index ec53eca..d17a11d 100644
--- a/categories/development/index.html
+++ b/categories/development/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Development" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -200,10 +203,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -261,5 +264,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/categories/development/index.xml b/categories/development/index.xml
index 51070e8..cd39c80 100644
--- a/categories/development/index.xml
+++ b/categories/development/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/development/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/development/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,8 +17,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -27,8 +1121,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -37,12 +1469,87 @@ This document is a brief primer on using go templates.</description>
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -51,9 +1558,177 @@ Follow the following steps:
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
</channel>
diff --git a/categories/english/index.html b/categories/english/index.html
index 2afbe77..57f464a 100644
--- a/categories/english/index.html
+++ b/categories/english/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="English" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -167,10 +170,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -228,5 +231,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/categories/english/index.xml b/categories/english/index.xml
index 4a99cf2..255bdf2 100644
--- a/categories/english/index.xml
+++ b/categories/english/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Thu, 31 Aug 2017 15:43:48 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/english/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/english/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,1101 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/english-preview/</guid>
- <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or jane delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;</description>
+
</item>
</channel>
diff --git a/categories/golang/index.html b/categories/golang/index.html
index e42e8bf..2e574b2 100644
--- a/categories/golang/index.html
+++ b/categories/golang/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Golang" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -200,10 +203,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -261,5 +264,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/categories/golang/index.xml b/categories/golang/index.xml
index d523856..7af4d65 100644
--- a/categories/golang/index.xml
+++ b/categories/golang/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/golang/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/golang/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,8 +17,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -27,8 +1121,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -37,12 +1469,87 @@ This document is a brief primer on using go templates.</description>
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -51,9 +1558,177 @@ Follow the following steps:
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
</channel>
diff --git a/categories/index.html b/categories/index.html
index 75532c5..b15d37b 100644
--- a/categories/index.html
+++ b/categories/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Categories" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -419,5 +422,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/categories/index.xml b/categories/index.xml
index c495940..a27d3c1 100644
--- a/categories/index.xml
+++ b/categories/index.xml
@@ -7,7 +7,7 @@
<generator>Hugo -- gohugo.io</generator>
<language>en</language>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -16,7 +16,9 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/categories/development/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -25,7 +27,9 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/categories/english/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -34,7 +38,9 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/categories/golang/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -43,7 +49,9 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/categories/index/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -52,7 +60,9 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/categories/shortcodes/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -61,7 +71,9 @@
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/categories/syntax-highlighting/</guid>
- <description></description>
+
+ <description></description>
+
</item>
</channel>
diff --git a/categories/index/index.html b/categories/index/index.html
index f3be50e..ccd940c 100644
--- a/categories/index/index.html
+++ b/categories/index/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Index" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -244,10 +247,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -305,5 +308,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/categories/index/index.xml b/categories/index/index.xml
index 50c1bdc..aabbff0 100644
--- a/categories/index/index.xml
+++ b/categories/index/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 06 Mar 2018 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/index/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/index/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,336 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/jane-theme-preview/</guid>
- <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
+
+ <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
&lt;p&gt;Please note that HTML fragments in markdown source will be recognized but not parsed or rendered. Also, there may be small reformatting on the original markdown source code after saving.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;paragraph-and-line-breaks&#34;&gt;Paragraph and line breaks&lt;/h2&gt;
+
+&lt;p&gt;A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by more than one blank lines. In Typora, you only need to press &lt;code&gt;Return&lt;/code&gt; to create a new paragraph.&lt;/p&gt;
+
+&lt;p&gt;Press &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Return&lt;/code&gt; to create a single line break. However, most markdown parser will ignore single line break, to make other markdown parsers recognize your line break, you can leave two whitespace at the end of the line, or insert &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;headers&#34;&gt;Headers&lt;/h2&gt;
+
+&lt;p&gt;Headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;# This is an H1
+
+## This is an H2
+
+###### This is an H6
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, input ‘#’s followed by title content, and press &lt;code&gt;Return&lt;/code&gt; key will create a header.&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Markdown uses email-style &amp;gt; characters for block quoting. They are presented as:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;This is a blockquote with two paragraphs. This is first paragraph.&lt;/p&gt;
+
+&lt;p&gt;This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.&lt;/p&gt;
+
+&lt;p&gt;This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;In typora, just input ‘&amp;gt;’ followed by quote contents a block quote is generated. Typora will insert proper ‘&amp;gt;’ or line break for you. Block quote inside anther block quote is allowed by adding additional levels of ‘&amp;gt;’.&lt;/p&gt;
+
+&lt;h2 id=&#34;lists&#34;&gt;Lists&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;* list item 1&lt;/code&gt; will create an un-ordered list, the &lt;code&gt;*&lt;/code&gt; symbol can be replace with &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;1. list item 1&lt;/code&gt; will create an ordered list, their markdown source code is like:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;task-list&#34;&gt;Task List&lt;/h2&gt;
+
+&lt;p&gt;Task lists are lists with items marked as either [ ] or &lt;a href=&#34;incomplete or complete&#34;&gt;x&lt;/a&gt;. For example:&lt;/p&gt;
+
+&lt;ul class=&#34;task-list&#34;&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; a task list item&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; list syntax required&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; normal &lt;strong&gt;formatting&lt;/strong&gt;, @mentions, #1234 refs&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; incomplete&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; checked disabled class=&#34;task-list-item&#34;&gt; completed&lt;/label&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;You can change the complete/incomplete state by click the checkbox before the item.&lt;/p&gt;
+
+&lt;h2 id=&#34;syntax-highlighting&#34;&gt;Syntax Highlighting&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+ alert(&amp;quot;Hello, World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;math-blocks&#34;&gt;Math Blocks&lt;/h2&gt;
+
+&lt;p&gt;You can render *LaTeX* mathematical expressions using &lt;strong&gt;MathJax&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;$$&lt;/code&gt;, then press &amp;lsquo;Return&amp;rsquo; key will trigger an input field which accept &lt;em&gt;Tex/LaTex&lt;/em&gt; source. Following is an example:
+$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} &lt;br /&gt;
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 &lt;br /&gt;
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 &lt;br /&gt;
+\end{vmatrix}
+$$&lt;/p&gt;
+
+&lt;p&gt;In markdown source file, math block is &lt;em&gt;LaTeX&lt;/em&gt; expression wrapped by ‘$$’ mark:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} \\
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 \\
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 \\
+\end{vmatrix}
+$$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;tables&#34;&gt;Tables&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;| First Header | Second Header |&lt;/code&gt; and press &lt;code&gt;return&lt;/code&gt; key will create a table with two column.&lt;/p&gt;
+
+&lt;p&gt;After table is created, focus on that table will pop up a toolbar for table, where you can resize, align, or delete table. You can also use context menu to copy and add/delete column/row.&lt;/p&gt;
+
+&lt;p&gt;Following descriptions can be skipped, as markdown source code for tables are generated by typora automatically.&lt;/p&gt;
+
+&lt;p&gt;In markdown source code, they look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;| First Header | Second Header |
+| ------------- | ------------- |
+| Content Cell | Content Cell |
+| Content Cell | Content Cell |
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+&lt;tr&gt;
+&lt;th&gt;First Header&lt;/th&gt;
+&lt;th&gt;Second Header&lt;/th&gt;
+&lt;/tr&gt;
+&lt;/thead&gt;
+
+&lt;tbody&gt;
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h2 id=&#34;footnotes&#34;&gt;Footnotes&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;You can create footnotes like this[^footnote].
+
+[^footnote]: Here is the *text* of the **footnote**.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;You can create footnotes like this&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:footnote&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:footnote&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
+
+&lt;p&gt;Mouse on the ‘footnote’ superscript to see content of the footnote.&lt;/p&gt;
+
+&lt;h2 id=&#34;horizontal-rules&#34;&gt;Horizontal Rules&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;***&lt;/code&gt; or &lt;code&gt;---&lt;/code&gt; on a blank line and press &lt;code&gt;return&lt;/code&gt; will draw a horizontal line.&lt;/p&gt;
+
+&lt;hr /&gt;
+
+&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
+
+&lt;p&gt;Markdown supports two style of links: inline and reference.&lt;/p&gt;
+
+&lt;p&gt;In both styles, the link text is delimited by [square brackets].&lt;/p&gt;
+
+&lt;p&gt;To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example](http://example.com/ &amp;quot;Title&amp;quot;) inline link.
+
+[This link](http://example.net/) has no title attribute.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Title&#34;&gt;an example&lt;/a&gt; inline link. (&lt;code&gt;&amp;lt;p&amp;gt;This is &amp;lt;a href=&amp;quot;http://example.com/&amp;quot; title=&amp;quot;Title&amp;quot;&amp;gt;&lt;/code&gt;)&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://example.net/&#34;&gt;This link&lt;/a&gt; has no title attribute. (&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://example.net/&amp;quot;&amp;gt;This link&amp;lt;/a&amp;gt; has no&lt;/code&gt;)&lt;/p&gt;
+
+&lt;h3 id=&#34;internal-links&#34;&gt;Internal Links&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;You can set the href to headers&lt;/strong&gt;, which will create a bookmark that allow you to jump to that section after clicking. For example:&lt;/p&gt;
+
+&lt;p&gt;Command(on Windows: Ctrl) + Click &lt;a href=&#34;#block-elements&#34;&gt;This link&lt;/a&gt; will jump to header &lt;code&gt;Block Elements&lt;/code&gt;. To see how to write that, please move cursor or click that link with &lt;code&gt;⌘&lt;/code&gt; key pressed to expand the element into markdown source.&lt;/p&gt;
+
+&lt;h3 id=&#34;reference-links&#34;&gt;Reference Links&lt;/h3&gt;
+
+&lt;p&gt;Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example][id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this, on a line by itself:
+
+[id]: http://example.com/ &amp;quot;Optional Title Here&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, they will be rendered like:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Optional Title Here&#34;&gt;an example&lt;/a&gt; reference-style link.&lt;/p&gt;
+
+&lt;p&gt;The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;[Google][]
+And then define the link:
+
+[Google]: http://google.com/
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora click link will expand it for editing, command+click will open the hyperlink in web browser.&lt;/p&gt;
+
+&lt;h2 id=&#34;urls&#34;&gt;URLs&lt;/h2&gt;
+
+&lt;p&gt;Typora allows you to insert urls as links, wrapped by &lt;code&gt;&amp;lt;&lt;/code&gt;brackets&lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;i@typora.io&amp;gt;&lt;/code&gt; becomes &lt;a href=&#34;mailto:i@typora.io&#34;&gt;i@typora.io&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Typora will aslo auto link standard URLs. e.g: www.google.com.&lt;/p&gt;
+
+&lt;h2 id=&#34;images&#34;&gt;Images&lt;/h2&gt;
+
+&lt;p&gt;Image looks similar with links, but it requires an additional &lt;code&gt;!&lt;/code&gt; char before the start of link. Image syntax looks like this:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg &amp;quot;Optional title&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;You are able to use drag &amp;amp; drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag &amp;amp; drop.&lt;/p&gt;
+
+&lt;p&gt;For more tips on images, please read &lt;a href=&#34;http://support.typora.io//Images/&#34;&gt;http://support.typora.io//Images/&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;emphasis&#34;&gt;Emphasis&lt;/h2&gt;
+
+&lt;p&gt;Markdown treats asterisks (&lt;code&gt;*&lt;/code&gt;) and underscores (&lt;code&gt;_&lt;/code&gt;) as indicators of emphasis. Text wrapped with one &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt; will be wrapped with an HTML &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag. E.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;*single asterisks*
+
+_single underscores_
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single asterisks&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single underscores&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;GFM will ignores underscores in words, which is commonly used in code and names, like this:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;wow_great_stuff&lt;/p&gt;
+
+&lt;p&gt;do_this_and_do_that_and_another_thing.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;\*this text is surrounded by literal asterisks\*
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;*&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;strong&#34;&gt;Strong&lt;/h2&gt;
+
+&lt;p&gt;double *’s or _’s will be wrapped with an HTML &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag, e.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;**double asterisks**
+
+__double underscores__
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double asterisks&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double underscores&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;**&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
+
+&lt;p&gt;To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;Use the `printf()` function.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
+
+&lt;h2 id=&#34;strikethrough&#34;&gt;Strikethrough&lt;/h2&gt;
+
+&lt;p&gt;GFM adds syntax to create strikethrough text, which is missing from standard Markdown.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;~~Mistaken text.~~&lt;/code&gt; becomes &lt;del&gt;Mistaken text.&lt;/del&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;underline&#34;&gt;Underline&lt;/h2&gt;
+
+&lt;p&gt;Underline is powered by raw HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;u&amp;gt;Underline&amp;lt;/u&amp;gt;&lt;/code&gt; becomes &lt;u&gt;Underline&lt;/u&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;emoji-happy&#34;&gt;Emoji :happy:&lt;/h2&gt;
+
+&lt;p&gt;Input emoji with syntax &lt;code&gt;😄&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;User can trigger auto-complete suggestions for emoji by pressing &lt;code&gt;ESC&lt;/code&gt; key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from &lt;code&gt;Edit&lt;/code&gt; -&amp;gt; &lt;code&gt;Emoji &amp;amp; Symbols&lt;/code&gt; from menu bar is also supported.&lt;/p&gt;
+
+&lt;h2 id=&#34;inline-math&#34;&gt;Inline Math&lt;/h2&gt;
+
+&lt;p&gt;To use this feature, first, please enable it in &lt;code&gt;Preference&lt;/code&gt; Panel -&amp;gt; &lt;code&gt;Markdown&lt;/code&gt; Tab. Then use &lt;code&gt;$&lt;/code&gt; to wrap TeX command, for example: &lt;code&gt;$\lim_{x \to \infty} \exp(-x) = 0$&lt;/code&gt; will be rendered as LaTeX command.&lt;/p&gt;
+
+&lt;p&gt;To trigger inline preview for inline math: input “$”, then press &lt;code&gt;ESC&lt;/code&gt; key, then input TeX command, a preview tooltip will be visible like below:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;http://typora.io/img/inline-math.gif&#34; style=&#34;zoom:50%;&#34; /&gt;&lt;/p&gt;
+&lt;div class=&#34;footnotes&#34;&gt;
+
+&lt;hr /&gt;
+
+&lt;ol&gt;
+&lt;li id=&#34;fn:footnote&#34;&gt;Here is the &lt;em&gt;text&lt;/em&gt; of the &lt;strong&gt;footnote&lt;/strong&gt;.
+ &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:footnote&#34;&gt;&lt;sup&gt;[return]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
+&lt;/ol&gt;
+&lt;/div&gt;</description>
+
</item>
<item>
@@ -30,7 +355,8 @@
<pubDate>Sun, 04 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/shortcodes-preview/</guid>
- <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
&lt;p&gt;Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video &lt;code&gt;&amp;lt;iframes&amp;gt;&lt;/code&gt;) to Markdown content. We think this contradicts the beautiful simplicity of Markdown&amp;rsquo;s syntax.&lt;/p&gt;
@@ -42,7 +368,381 @@
&lt;p&gt;More details: &lt;a href=&#34;https://gohugo.io/content-management/shortcodes/&#34;&gt;https://gohugo.io/content-management/shortcodes/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Normal quote:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a simple quote.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote with only an Author named Author2.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author2&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author3 and source &#34;source.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author3&lt;/strong&gt;
+
+ &lt;cite&gt;Source&lt;/cite&gt;
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and link:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author4 and links to https://www.google.com.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author4&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;google.com&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author, link and title:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://www.google.com with title &#34;Google.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author5&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;Google&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and a link longer than 32 characters, string is first cut at 32 characters then everything after the last forward slash is removed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://twitter.com/CryptoGangsta/status/716427930126196737 which is longer than 32 characters.
+ &lt;br&gt;And this is a new line in the quote with the HTML br tag.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author6&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34; title=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34;&gt;twitter.com/CryptoGangsta/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Test from the Octopress blockquote page at: &lt;a href=&#34;http://octopress.org/docs/plugins/blockquote/&#34;&gt;http://octopress.org/docs/plugins/blockquote/&lt;/a&gt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ Over the past 24 hours I&#39;ve been reflecting on my life &amp; I&#39;ve realized only one thing. I need a medieval battle axe.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;@allanbranch&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34; title=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34;&gt;twitter.com/allanbranch/status/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;h2 id=&#34;music&#34;&gt;music&lt;/h2&gt;
+
+ &lt;iframe style=&#34;max-width: 100%&#34;
+ class=&#34;music163&#34;
+ frameborder=&#34;no&#34;
+ border=&#34;0&#34;
+ marginwidth=&#34;0&#34;
+ marginheight=&#34;0&#34;
+ width=&#34;330&#34;
+ height=&#34;86&#34;
+ src=&#34;//music.163.com/outchain/player?type=2&amp;id=3950552&amp;auto=0&amp;height=66&#34;&gt;
+ &lt;/iframe&gt;
+
+&lt;h2 id=&#34;gist&#34;&gt;gist&lt;/h2&gt;
+
+&lt;p&gt;We can embed the gist in our content via username and gist ID pulled from the URL:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{&amp;lt; gist spf13 7896402 &amp;gt;}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Display:&lt;/p&gt;
+
+&lt;script src=&#34;//gist.github.com/spf13/7896402.js&#34;&gt;&lt;/script&gt;
+
+&lt;h2 id=&#34;youtube&#34;&gt;youtube&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//www.youtube.com/embed/w7Ft2ymGmfc&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; allowfullscreen frameborder=&#34;0&#34; title=&#34;YouTube Video&#34;&gt;&lt;/iframe&gt;
+ &lt;/div&gt;
+
+
+&lt;h2 id=&#34;vimeo&#34;&gt;vimeo&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//player.vimeo.com/video/146022717&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
+ &lt;/div&gt;</description>
+
</item>
<item>
@@ -51,11 +751,1101 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/english-preview/</guid>
- <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or jane delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;</description>
+
</item>
<item>
@@ -64,8 +1854,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -74,8 +2958,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -84,12 +3306,87 @@ This document is a brief primer on using go templates.</description>
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -98,9 +3395,177 @@ Follow the following steps:
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -109,12 +3574,84 @@ Follow the following steps:
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/syntax-highlighting/</guid>
- <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+
+ <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
alert(&amp;quot;Hello, World!&amp;quot;)
}
&lt;/code&gt;&lt;/pre&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-kotlin&#34;&gt;package hello
+
+fun main(args: Array&amp;lt;String&amp;gt;) {
+ println(&amp;quot;Hello World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;#include &amp;lt;stdio.h&amp;gt;
+
+/* Hello */
+int main(void){
+ printf(&amp;quot;Hello, World!&amp;quot;);
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cpp&#34;&gt;// &#39;Hello World!&#39; program
+
+#include &amp;lt;iostream&amp;gt;
+
+int main(){
+ std::cout &amp;lt;&amp;lt; &amp;quot;Hello World!&amp;quot; &amp;lt;&amp;lt; std::endl;
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cs&#34;&gt;using System;
+class HelloWorld{
+ public static void Main(){
+ System.Console.WriteLine(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-html&#34;&gt;&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ Hello, World!
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main
+import fmt &amp;quot;fmt&amp;quot;
+
+func main()
+{
+ fmt.Printf(&amp;quot;Hello, World!\n&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-scala&#34;&gt;object HelloWorld with Application {
+ Console.println(&amp;quot;Hello, World!&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-php&#34;&gt;&amp;lt;?php
+ echo &#39;Hello, World!&#39;;
+?&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(&amp;quot;Hello, World!&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;</description>
+
</item>
</channel>
diff --git a/categories/shortcodes/index.html b/categories/shortcodes/index.html
index 6b82b9e..807aa4c 100644
--- a/categories/shortcodes/index.html
+++ b/categories/shortcodes/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Shortcodes" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -178,10 +181,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -239,5 +242,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/categories/shortcodes/index.xml b/categories/shortcodes/index.xml
index b047b87..af7ea98 100644
--- a/categories/shortcodes/index.xml
+++ b/categories/shortcodes/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 06 Mar 2018 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/shortcodes/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/shortcodes/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,336 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/jane-theme-preview/</guid>
- <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
+
+ <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
&lt;p&gt;Please note that HTML fragments in markdown source will be recognized but not parsed or rendered. Also, there may be small reformatting on the original markdown source code after saving.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;paragraph-and-line-breaks&#34;&gt;Paragraph and line breaks&lt;/h2&gt;
+
+&lt;p&gt;A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by more than one blank lines. In Typora, you only need to press &lt;code&gt;Return&lt;/code&gt; to create a new paragraph.&lt;/p&gt;
+
+&lt;p&gt;Press &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Return&lt;/code&gt; to create a single line break. However, most markdown parser will ignore single line break, to make other markdown parsers recognize your line break, you can leave two whitespace at the end of the line, or insert &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;headers&#34;&gt;Headers&lt;/h2&gt;
+
+&lt;p&gt;Headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;# This is an H1
+
+## This is an H2
+
+###### This is an H6
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, input ‘#’s followed by title content, and press &lt;code&gt;Return&lt;/code&gt; key will create a header.&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Markdown uses email-style &amp;gt; characters for block quoting. They are presented as:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;This is a blockquote with two paragraphs. This is first paragraph.&lt;/p&gt;
+
+&lt;p&gt;This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.&lt;/p&gt;
+
+&lt;p&gt;This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;In typora, just input ‘&amp;gt;’ followed by quote contents a block quote is generated. Typora will insert proper ‘&amp;gt;’ or line break for you. Block quote inside anther block quote is allowed by adding additional levels of ‘&amp;gt;’.&lt;/p&gt;
+
+&lt;h2 id=&#34;lists&#34;&gt;Lists&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;* list item 1&lt;/code&gt; will create an un-ordered list, the &lt;code&gt;*&lt;/code&gt; symbol can be replace with &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;1. list item 1&lt;/code&gt; will create an ordered list, their markdown source code is like:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;task-list&#34;&gt;Task List&lt;/h2&gt;
+
+&lt;p&gt;Task lists are lists with items marked as either [ ] or &lt;a href=&#34;incomplete or complete&#34;&gt;x&lt;/a&gt;. For example:&lt;/p&gt;
+
+&lt;ul class=&#34;task-list&#34;&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; a task list item&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; list syntax required&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; normal &lt;strong&gt;formatting&lt;/strong&gt;, @mentions, #1234 refs&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; incomplete&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; checked disabled class=&#34;task-list-item&#34;&gt; completed&lt;/label&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;You can change the complete/incomplete state by click the checkbox before the item.&lt;/p&gt;
+
+&lt;h2 id=&#34;syntax-highlighting&#34;&gt;Syntax Highlighting&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+ alert(&amp;quot;Hello, World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;math-blocks&#34;&gt;Math Blocks&lt;/h2&gt;
+
+&lt;p&gt;You can render *LaTeX* mathematical expressions using &lt;strong&gt;MathJax&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;$$&lt;/code&gt;, then press &amp;lsquo;Return&amp;rsquo; key will trigger an input field which accept &lt;em&gt;Tex/LaTex&lt;/em&gt; source. Following is an example:
+$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} &lt;br /&gt;
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 &lt;br /&gt;
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 &lt;br /&gt;
+\end{vmatrix}
+$$&lt;/p&gt;
+
+&lt;p&gt;In markdown source file, math block is &lt;em&gt;LaTeX&lt;/em&gt; expression wrapped by ‘$$’ mark:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} \\
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 \\
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 \\
+\end{vmatrix}
+$$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;tables&#34;&gt;Tables&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;| First Header | Second Header |&lt;/code&gt; and press &lt;code&gt;return&lt;/code&gt; key will create a table with two column.&lt;/p&gt;
+
+&lt;p&gt;After table is created, focus on that table will pop up a toolbar for table, where you can resize, align, or delete table. You can also use context menu to copy and add/delete column/row.&lt;/p&gt;
+
+&lt;p&gt;Following descriptions can be skipped, as markdown source code for tables are generated by typora automatically.&lt;/p&gt;
+
+&lt;p&gt;In markdown source code, they look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;| First Header | Second Header |
+| ------------- | ------------- |
+| Content Cell | Content Cell |
+| Content Cell | Content Cell |
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+&lt;tr&gt;
+&lt;th&gt;First Header&lt;/th&gt;
+&lt;th&gt;Second Header&lt;/th&gt;
+&lt;/tr&gt;
+&lt;/thead&gt;
+
+&lt;tbody&gt;
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h2 id=&#34;footnotes&#34;&gt;Footnotes&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;You can create footnotes like this[^footnote].
+
+[^footnote]: Here is the *text* of the **footnote**.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;You can create footnotes like this&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:footnote&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:footnote&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
+
+&lt;p&gt;Mouse on the ‘footnote’ superscript to see content of the footnote.&lt;/p&gt;
+
+&lt;h2 id=&#34;horizontal-rules&#34;&gt;Horizontal Rules&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;***&lt;/code&gt; or &lt;code&gt;---&lt;/code&gt; on a blank line and press &lt;code&gt;return&lt;/code&gt; will draw a horizontal line.&lt;/p&gt;
+
+&lt;hr /&gt;
+
+&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
+
+&lt;p&gt;Markdown supports two style of links: inline and reference.&lt;/p&gt;
+
+&lt;p&gt;In both styles, the link text is delimited by [square brackets].&lt;/p&gt;
+
+&lt;p&gt;To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example](http://example.com/ &amp;quot;Title&amp;quot;) inline link.
+
+[This link](http://example.net/) has no title attribute.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Title&#34;&gt;an example&lt;/a&gt; inline link. (&lt;code&gt;&amp;lt;p&amp;gt;This is &amp;lt;a href=&amp;quot;http://example.com/&amp;quot; title=&amp;quot;Title&amp;quot;&amp;gt;&lt;/code&gt;)&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://example.net/&#34;&gt;This link&lt;/a&gt; has no title attribute. (&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://example.net/&amp;quot;&amp;gt;This link&amp;lt;/a&amp;gt; has no&lt;/code&gt;)&lt;/p&gt;
+
+&lt;h3 id=&#34;internal-links&#34;&gt;Internal Links&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;You can set the href to headers&lt;/strong&gt;, which will create a bookmark that allow you to jump to that section after clicking. For example:&lt;/p&gt;
+
+&lt;p&gt;Command(on Windows: Ctrl) + Click &lt;a href=&#34;#block-elements&#34;&gt;This link&lt;/a&gt; will jump to header &lt;code&gt;Block Elements&lt;/code&gt;. To see how to write that, please move cursor or click that link with &lt;code&gt;⌘&lt;/code&gt; key pressed to expand the element into markdown source.&lt;/p&gt;
+
+&lt;h3 id=&#34;reference-links&#34;&gt;Reference Links&lt;/h3&gt;
+
+&lt;p&gt;Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example][id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this, on a line by itself:
+
+[id]: http://example.com/ &amp;quot;Optional Title Here&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, they will be rendered like:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Optional Title Here&#34;&gt;an example&lt;/a&gt; reference-style link.&lt;/p&gt;
+
+&lt;p&gt;The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;[Google][]
+And then define the link:
+
+[Google]: http://google.com/
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora click link will expand it for editing, command+click will open the hyperlink in web browser.&lt;/p&gt;
+
+&lt;h2 id=&#34;urls&#34;&gt;URLs&lt;/h2&gt;
+
+&lt;p&gt;Typora allows you to insert urls as links, wrapped by &lt;code&gt;&amp;lt;&lt;/code&gt;brackets&lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;i@typora.io&amp;gt;&lt;/code&gt; becomes &lt;a href=&#34;mailto:i@typora.io&#34;&gt;i@typora.io&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Typora will aslo auto link standard URLs. e.g: www.google.com.&lt;/p&gt;
+
+&lt;h2 id=&#34;images&#34;&gt;Images&lt;/h2&gt;
+
+&lt;p&gt;Image looks similar with links, but it requires an additional &lt;code&gt;!&lt;/code&gt; char before the start of link. Image syntax looks like this:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg &amp;quot;Optional title&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;You are able to use drag &amp;amp; drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag &amp;amp; drop.&lt;/p&gt;
+
+&lt;p&gt;For more tips on images, please read &lt;a href=&#34;http://support.typora.io//Images/&#34;&gt;http://support.typora.io//Images/&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;emphasis&#34;&gt;Emphasis&lt;/h2&gt;
+
+&lt;p&gt;Markdown treats asterisks (&lt;code&gt;*&lt;/code&gt;) and underscores (&lt;code&gt;_&lt;/code&gt;) as indicators of emphasis. Text wrapped with one &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt; will be wrapped with an HTML &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag. E.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;*single asterisks*
+
+_single underscores_
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single asterisks&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single underscores&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;GFM will ignores underscores in words, which is commonly used in code and names, like this:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;wow_great_stuff&lt;/p&gt;
+
+&lt;p&gt;do_this_and_do_that_and_another_thing.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;\*this text is surrounded by literal asterisks\*
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;*&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;strong&#34;&gt;Strong&lt;/h2&gt;
+
+&lt;p&gt;double *’s or _’s will be wrapped with an HTML &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag, e.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;**double asterisks**
+
+__double underscores__
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double asterisks&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double underscores&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;**&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
+
+&lt;p&gt;To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;Use the `printf()` function.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
+
+&lt;h2 id=&#34;strikethrough&#34;&gt;Strikethrough&lt;/h2&gt;
+
+&lt;p&gt;GFM adds syntax to create strikethrough text, which is missing from standard Markdown.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;~~Mistaken text.~~&lt;/code&gt; becomes &lt;del&gt;Mistaken text.&lt;/del&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;underline&#34;&gt;Underline&lt;/h2&gt;
+
+&lt;p&gt;Underline is powered by raw HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;u&amp;gt;Underline&amp;lt;/u&amp;gt;&lt;/code&gt; becomes &lt;u&gt;Underline&lt;/u&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;emoji-happy&#34;&gt;Emoji :happy:&lt;/h2&gt;
+
+&lt;p&gt;Input emoji with syntax &lt;code&gt;😄&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;User can trigger auto-complete suggestions for emoji by pressing &lt;code&gt;ESC&lt;/code&gt; key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from &lt;code&gt;Edit&lt;/code&gt; -&amp;gt; &lt;code&gt;Emoji &amp;amp; Symbols&lt;/code&gt; from menu bar is also supported.&lt;/p&gt;
+
+&lt;h2 id=&#34;inline-math&#34;&gt;Inline Math&lt;/h2&gt;
+
+&lt;p&gt;To use this feature, first, please enable it in &lt;code&gt;Preference&lt;/code&gt; Panel -&amp;gt; &lt;code&gt;Markdown&lt;/code&gt; Tab. Then use &lt;code&gt;$&lt;/code&gt; to wrap TeX command, for example: &lt;code&gt;$\lim_{x \to \infty} \exp(-x) = 0$&lt;/code&gt; will be rendered as LaTeX command.&lt;/p&gt;
+
+&lt;p&gt;To trigger inline preview for inline math: input “$”, then press &lt;code&gt;ESC&lt;/code&gt; key, then input TeX command, a preview tooltip will be visible like below:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;http://typora.io/img/inline-math.gif&#34; style=&#34;zoom:50%;&#34; /&gt;&lt;/p&gt;
+&lt;div class=&#34;footnotes&#34;&gt;
+
+&lt;hr /&gt;
+
+&lt;ol&gt;
+&lt;li id=&#34;fn:footnote&#34;&gt;Here is the &lt;em&gt;text&lt;/em&gt; of the &lt;strong&gt;footnote&lt;/strong&gt;.
+ &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:footnote&#34;&gt;&lt;sup&gt;[return]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
+&lt;/ol&gt;
+&lt;/div&gt;</description>
+
</item>
<item>
@@ -30,7 +355,8 @@
<pubDate>Sun, 04 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/shortcodes-preview/</guid>
- <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
&lt;p&gt;Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video &lt;code&gt;&amp;lt;iframes&amp;gt;&lt;/code&gt;) to Markdown content. We think this contradicts the beautiful simplicity of Markdown&amp;rsquo;s syntax.&lt;/p&gt;
@@ -42,7 +368,381 @@
&lt;p&gt;More details: &lt;a href=&#34;https://gohugo.io/content-management/shortcodes/&#34;&gt;https://gohugo.io/content-management/shortcodes/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Normal quote:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a simple quote.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote with only an Author named Author2.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author2&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author3 and source &#34;source.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author3&lt;/strong&gt;
+
+ &lt;cite&gt;Source&lt;/cite&gt;
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and link:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author4 and links to https://www.google.com.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author4&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;google.com&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author, link and title:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://www.google.com with title &#34;Google.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author5&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;Google&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and a link longer than 32 characters, string is first cut at 32 characters then everything after the last forward slash is removed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://twitter.com/CryptoGangsta/status/716427930126196737 which is longer than 32 characters.
+ &lt;br&gt;And this is a new line in the quote with the HTML br tag.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author6&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34; title=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34;&gt;twitter.com/CryptoGangsta/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Test from the Octopress blockquote page at: &lt;a href=&#34;http://octopress.org/docs/plugins/blockquote/&#34;&gt;http://octopress.org/docs/plugins/blockquote/&lt;/a&gt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ Over the past 24 hours I&#39;ve been reflecting on my life &amp; I&#39;ve realized only one thing. I need a medieval battle axe.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;@allanbranch&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34; title=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34;&gt;twitter.com/allanbranch/status/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;h2 id=&#34;music&#34;&gt;music&lt;/h2&gt;
+
+ &lt;iframe style=&#34;max-width: 100%&#34;
+ class=&#34;music163&#34;
+ frameborder=&#34;no&#34;
+ border=&#34;0&#34;
+ marginwidth=&#34;0&#34;
+ marginheight=&#34;0&#34;
+ width=&#34;330&#34;
+ height=&#34;86&#34;
+ src=&#34;//music.163.com/outchain/player?type=2&amp;id=3950552&amp;auto=0&amp;height=66&#34;&gt;
+ &lt;/iframe&gt;
+
+&lt;h2 id=&#34;gist&#34;&gt;gist&lt;/h2&gt;
+
+&lt;p&gt;We can embed the gist in our content via username and gist ID pulled from the URL:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{&amp;lt; gist spf13 7896402 &amp;gt;}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Display:&lt;/p&gt;
+
+&lt;script src=&#34;//gist.github.com/spf13/7896402.js&#34;&gt;&lt;/script&gt;
+
+&lt;h2 id=&#34;youtube&#34;&gt;youtube&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//www.youtube.com/embed/w7Ft2ymGmfc&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; allowfullscreen frameborder=&#34;0&#34; title=&#34;YouTube Video&#34;&gt;&lt;/iframe&gt;
+ &lt;/div&gt;
+
+
+&lt;h2 id=&#34;vimeo&#34;&gt;vimeo&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//player.vimeo.com/video/146022717&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
+ &lt;/div&gt;</description>
+
</item>
</channel>
diff --git a/categories/syntax-highlighting/index.html b/categories/syntax-highlighting/index.html
index 96fceae..2daf660 100644
--- a/categories/syntax-highlighting/index.html
+++ b/categories/syntax-highlighting/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Syntax Highlighting" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -167,10 +170,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -228,5 +231,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/categories/syntax-highlighting/index.xml b/categories/syntax-highlighting/index.xml
index 2690ae0..49ee4d2 100644
--- a/categories/syntax-highlighting/index.xml
+++ b/categories/syntax-highlighting/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 30 Aug 2011 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/syntax-highlighting/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/categories/syntax-highlighting/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,12 +17,84 @@
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/syntax-highlighting/</guid>
- <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+
+ <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
alert(&amp;quot;Hello, World!&amp;quot;)
}
&lt;/code&gt;&lt;/pre&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-kotlin&#34;&gt;package hello
+
+fun main(args: Array&amp;lt;String&amp;gt;) {
+ println(&amp;quot;Hello World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;#include &amp;lt;stdio.h&amp;gt;
+
+/* Hello */
+int main(void){
+ printf(&amp;quot;Hello, World!&amp;quot;);
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cpp&#34;&gt;// &#39;Hello World!&#39; program
+
+#include &amp;lt;iostream&amp;gt;
+
+int main(){
+ std::cout &amp;lt;&amp;lt; &amp;quot;Hello World!&amp;quot; &amp;lt;&amp;lt; std::endl;
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cs&#34;&gt;using System;
+class HelloWorld{
+ public static void Main(){
+ System.Console.WriteLine(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-html&#34;&gt;&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ Hello, World!
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main
+import fmt &amp;quot;fmt&amp;quot;
+
+func main()
+{
+ fmt.Printf(&amp;quot;Hello, World!\n&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-scala&#34;&gt;object HelloWorld with Application {
+ Console.println(&amp;quot;Hello, World!&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-php&#34;&gt;&amp;lt;?php
+ echo &#39;Hello, World!&#39;;
+?&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(&amp;quot;Hello, World!&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;</description>
+
</item>
</channel>
diff --git a/dist/jane.min.css b/dist/jane.min.css
index a38b816..8b74c3a 100644
--- a/dist/jane.min.css
+++ b/dist/jane.min.css
@@ -1,4 +1,4 @@
@font-face{font-family:Chancery;src:url(fonts/chancery/apple-chancery-webfont.eot);src:local("Apple Chancery"),url(fonts/chancery/apple-chancery-webfont.eot?#iefix) format("embedded-opentype"),url(fonts/chancery/apple-chancery-webfont.woff2) format("woff2"),url(fonts/chancery/apple-chancery-webfont.woff) format("woff"),url(fonts/chancery/apple-chancery-webfont.ttf) format("truetype"),url(fonts/chancery/apple-chancery-webfont.svg#apple-chancery) format("svg");font-weight:lighter;font-style:normal}
-/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}html{font-size:18px;-webkit-box-sizing:border-box;box-sizing:border-box}body{padding:0;margin:0;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-weight:400;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.8;color:#34495e;background:#fefefe;scroll-behavior:smooth}@media screen and (max-width:60em){body{border-top:0}}::-moz-selection{background:#c05b4d;color:#fff}::selection{background:#c05b4d;color:#fff}img{max-width:100%;height:auto;display:inline-block;vertical-align:middle}a{color:#34495e;text-decoration:none}h1{font-size:1.6em}h1,h2{font-family:Athelas,STHeiti,Microsoft Yahei,serif}h2{font-size:1.5em}h3{font-size:1.3em}h3,h4{font-family:Athelas,STHeiti,Microsoft Yahei,serif}h4{font-size:1.2em}h5{font-size:1.1em}h5,h6{font-family:Athelas,STHeiti,Microsoft Yahei,serif}h6{font-size:1em}.container{margin:0 auto;width:60em}@media screen and (max-width:60em){.container{width:100%;-webkit-box-shadow:-1px -5px 5px #cacaca;box-shadow:-1px -5px 5px #cacaca}}.content-wrapper{padding:3em 0 1px}.video-container{position:relative;padding-bottom:56.25%;padding-top:25px;height:0}.video-container iframe{position:absolute;top:0;left:0;width:100%;height:100%}.bg-llight{background-color:#f2f2f5}.bg-white{background-color:#fff}@font-face{font-family:iconfont;src:url(fonts/iconfont/iconfont.eot?hash=c2af3bb);src:url(fonts/iconfont/iconfont.eot?hash=c2af3bb#iefix) format("embedded-opentype"),url(fonts/iconfont/iconfont.woff?hash=5d21a10) format("woff"),url(fonts/iconfont/iconfont.ttf?hash=0e6028a) format("truetype"),url(fonts/iconfont/iconfont.svg?hash=566e23f#iconfont) format("svg")}.iconfont{font-family:iconfont!important;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale;cursor:pointer}.icon-instagram:before{font-size:.95em;content:"\E611";position:relative;top:-1px}.icon-douban:before{content:"\E610"}.icon-tumblr:before{content:"\E69F";font-size:.85em;position:relative;top:-4px}.icon-linkedin:before{content:"\E60D";position:relative;top:-4px}.icon-twitter:before{content:"\E600"}.icon-weibo:before{content:"\E602"}.icon-stack-overflow:before{content:"\E603";font-size:.85em;position:relative;top:-4px}.icon-email:before{content:"\E605";position:relative;top:-2px}.icon-facebook:before{content:"\E601";font-size:.95em;position:relative;top:-2px}.icon-github:before{content:"\E606";position:relative;top:-3px}.icon-rss:before{content:"\E604"}.icon-google:before{content:"\E609"}.icon-zhihu:before{content:"\E607";font-size:.9em;position:relative;top:-2px}.icon-pocket:before{content:"\E856"}.icon-heart:before{content:"\E608"}.icon-right:before{content:"\E60A"}.icon-left:before{content:"\E60B"}.icon-up:before{content:"\E60C"}.icon-close:before{content:"\E60F"}.header:after,.header:before{content:" ";display:table}.header:after{clear:both}.header .logo-wrapper{float:left}.header .logo-wrapper .logo{font-size:36px;font-family:Chancery,cursive}@media screen and (max-width:60em){.header .logo-wrapper{display:none}}.header .site-navbar .menu{float:right;padding-left:0;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.header .site-navbar .menu .menu-item{margin-left:1em;margin-right:1em;display:inline-block;vertical-align:middle;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-box-shadow:0 0 1px transparent;box-shadow:0 0 1px transparent;position:relative;overflow:hidden}.header .site-navbar .menu .menu-item+.menu-item{margin-left:10px}.header .site-navbar .menu .menu-item:before{content:"";position:absolute;z-index:-1;height:2px;bottom:0;left:51%;right:51%;background:#c05b4d;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-property:right,left;transition-property:right,left;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.header .site-navbar .menu .menu-item.active:before,.header .site-navbar .menu .menu-item:active:before,.header .site-navbar .menu .menu-item:focus:before,.header .site-navbar .menu .menu-item:hover:before{right:0;left:0}.header .site-navbar .menu .menu-item-link{font-size:18px}@media screen and (max-width:60em){.header .site-navbar{display:none}}@media screen and (max-width:60em){.header{padding:50px 0 0;text-align:center}}.post{padding:3em 5em;margin-bottom:3em}.post .post-header{margin-bottom:20px;text-align:center;padding-bottom:10px;border-bottom:2px solid #d3d3d3}.post .post-header .post-title{margin:0;font-size:1.8em;font-weight:400;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.post .post-header .post-link{display:inline-block;vertical-align:middle;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-box-shadow:0 0 1px transparent;box-shadow:0 0 1px transparent;position:relative;overflow:hidden}.post .post-header .post-link:before{content:"";position:absolute;z-index:-1;height:2px;bottom:0;left:51%;right:51%;background:#c05b4d;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-property:right,left;transition-property:right,left;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.post .post-header .post-link.active:before,.post .post-header .post-link:active:before,.post .post-header .post-link:focus:before,.post .post-header .post-link:hover:before{right:0;left:0}.post .post-header .post-meta{font-size:14px;color:#8a8a8a}.post .post-header .post-meta .post-time{font-size:15px}.post .post-header .post-meta .post-category{display:inline}.post .post-header .post-meta .post-category a{color:inherit}.post .post-header .post-meta .post-category a:before{content:"\B7"}.post .post-header .post-meta .post-category a:hover{color:#c05b4d}.post .post-header .post-meta .more-meta:before{content:"\B7"}.post .post-toc{padding:10px;font-family:Athelas,STHeiti,Microsoft Yahei,serif;border-bottom:2px solid #d3d3d3;word-wrap:break-word}.post .post-toc .post-toc-title{margin:0 10px;font-size:20px;font-weight:400;text-transform:uppercase}.post .post-toc .post-toc-content{font-size:15px}.post .post-toc .post-toc-content.always-active ul{display:block}.post .post-toc .post-toc-content>nav>ul{margin:10px 0}.post .post-toc .post-toc-content ul{padding-left:20px;list-style:square}.post .post-toc .post-toc-content ul li>a{color:#139}.post .post-toc .post-toc-content ul li>a:hover{color:#900}.post .post-toc .post-toc-content ul ul{list-style:circle}.post .post-toc .post-toc-content .toc-link.active{color:#c05b4d}.post .post-content{word-wrap:break-word}.post .post-content h1,.post .post-content h2,.post .post-content h3,.post .post-content h4,.post .post-content h5,.post .post-content h6{font-weight:600;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.post .post-content h1,.post .post-content h2{border-bottom:1px solid #ddd;margin-top:2em}.post .post-content h3{margin-top:1.5em}.post .post-content a{color:#c05b4d;word-break:break-all}.post .post-content a:hover{border-bottom:1px solid #c05b4d}.post .post-content a.fancybox{border:0}.post .post-content blockquote{margin:1em 0;padding:1px 20px;position:relative;color:rgba(52,73,94,.8);background-color:rgba(192,91,77,.05);border-left:3px solid rgba(192,91,77,.3);-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.125);box-shadow:1px 1px 2px rgba(0,0,0,.125)}.post .post-content blockquote footer,.post .post-content blockquote p{margin:.5em 0}.post .post-content blockquote cite:before{content:"\2014";padding-right:.3em;padding-left:.3em;color:#aaa}.post .post-content img{display:inline-block;max-width:100%}.post .post-content>table{max-width:100%;margin:10px 0;border-spacing:0;-webkit-box-shadow:2px 2px 3px rgba(0,0,0,.125);box-shadow:2px 2px 3px rgba(0,0,0,.125)}.post .post-content>table thead{background:#f8f5ec}.post .post-content>table td,.post .post-content>table th{padding:5px 15px;border:1px double #f4efe1}.post .post-content>table tr:hover{background-color:#f8f5ec}.post .post-content code,.post .post-content pre{padding:7px;font-size:13px;font-family:Consolas,Monaco,Menlo,monospace;background:#f8f5ec}.post .post-content code{padding:3px 5px;border-radius:4px;color:#c7254e}.post .post-content .highlight{margin:1em 0;border-radius:5px;overflow-x:auto;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.125);box-shadow:1px 1px 2px rgba(0,0,0,.125);position:relative}.post .post-content .highlight table{position:relative}.post .post-content .highlight table:after{position:absolute;top:0;right:0;left:0;padding:2px 7px;font-size:13px;font-weight:700;color:#b1b1b1;background:#f4efe1;content:"Code"}.post .post-content .highlight.language-bash>table:after{content:"Bash"}.post .post-content .highlight.language-c>table:after{content:"C"}.post .post-content .highlight.language-cs>table:after{content:"C#"}.post .post-content .highlight.language-cpp>table:after{content:"C++"}.post .post-content .highlight.language-css>table:after{content:"CSS"}.post .post-content .highlight.language-coffeescript>table:after{content:"CoffeeScript"}.post .post-content .highlight.language-html>table:after{content:"HTML"}.post .post-content .highlight.language-xml>table:after{content:"XML"}.post .post-content .highlight.language-http>table:after{content:"HTTP"}.post .post-content .highlight.language-json>table:after{content:"JSON"}.post .post-content .highlight.language-java>table:after{content:"Java"}.post .post-content .highlight.language-javascript>table:after,.post .post-content .highlight.language-js>table:after{content:"JavaScript"}.post .post-content .highlight.language-makefile>table:after{content:"Makefile"}.post .post-content .highlight.language-markdown>table:after{content:"Markdown"}.post .post-content .highlight.language-objectivec>table:after{content:"Objective-C"}.post .post-content .highlight.language-php>table:after{content:"PHP"}.post .post-content .highlight.language-perl>table:after{content:"Perl"}.post .post-content .highlight.language-python>table:after{content:"Python"}.post .post-content .highlight.language-ruby>table:after{content:"Ruby"}.post .post-content .highlight.language-sql>table:after{content:"SQL"}.post .post-content .highlight.language-shell>table:after{content:"Shell"}.post .post-content .highlight.language-erlang>table:after{content:"Erlang"}.post .post-content .highlight.language-go>table:after{content:"Go"}.post .post-content .highlight.language-groovy>table:after{content:"Groovy"}.post .post-content .highlight.language-haskell>table:after{content:"Haskell"}.post .post-content .highlight.language-kotlin>table:after{content:"Kotlin"}.post .post-content .highlight.language-less>table:after{content:"Less"}.post .post-content .highlight.language-lisp>table:after{content:"Lisp"}.post .post-content .highlight.language-lua>table:after{content:"Lua"}.post .post-content .highlight.language-matlab>table:after{content:"Matlab"}.post .post-content .highlight.language-rust>table:after{content:"Rust"}.post .post-content .highlight.language-scss>table:after{content:"Scss"}.post .post-content .highlight.language-scala>table:after{content:"Scala"}.post .post-content .highlight.language-swift>table:after{content:"Swift"}.post .post-content .highlight.language-typescript>table:after{content:"TypeScript"}.post .post-content .highlight.language-yaml>table:after,.post .post-content .highlight.language-yml>table:after{content:"YAML"}.post .post-content .highlight.language-toml>table:after{content:"TOML"}.post .post-content .highlight .code pre{margin:0;padding:30px 10px 10px}.post .post-content .highlight .gutter{width:10px;color:#cacaca}.post .post-content .highlight .gutter pre{margin:0;padding:30px 7px 10px}.post .post-content .highlight .line{height:20px}.post .post-content .highlight table,.post .post-content .highlight td,.post .post-content .highlight tr{margin:0;padding:0;width:100%;border-collapse:collapse}.post .post-content .highlight .code .hljs-comment,.post .post-content .highlight .code .hljs-quote{color:#93a1a1}.post .post-content .highlight .code .hljs-addition,.post .post-content .highlight .code .hljs-keyword,.post .post-content .highlight .code .hljs-selector-tag{color:#859900}.post .post-content .highlight .code .hljs-doctag,.post .post-content .highlight .code .hljs-literal,.post .post-content .highlight .code .hljs-meta .hljs-meta-string,.post .post-content .highlight .code .hljs-number,.post .post-content .highlight .code .hljs-regexp,.post .post-content .highlight .code .hljs-string{color:#2aa198}.post .post-content .highlight .code .hljs-name,.post .post-content .highlight .code .hljs-section,.post .post-content .highlight .code .hljs-selector-class,.post .post-content .highlight .code .hljs-selector-id,.post .post-content .highlight .code .hljs-title{color:#268bd2}.post .post-content .highlight .code .hljs-attr,.post .post-content .highlight .code .hljs-attribute,.post .post-content .highlight .code .hljs-class .hljs-title,.post .post-content .highlight .code .hljs-template-variable,.post .post-content .highlight .code .hljs-type,.post .post-content .highlight .code .hljs-variable{color:#b58900}.post .post-content .highlight .code .hljs-bullet,.post .post-content .highlight .code .hljs-link,.post .post-content .highlight .code .hljs-meta,.post .post-content .highlight .code .hljs-meta .hljs-keyword,.post .post-content .highlight .code .hljs-selector-attr,.post .post-content .highlight .code .hljs-selector-pseudo,.post .post-content .highlight .code .hljs-subst,.post .post-content .highlight .code .hljs-symbol{color:#cb4b16}.post .post-content .highlight .code .hljs-built_in,.post .post-content .highlight .code .hljs-deletion{color:#dc322f}.post .post-content .highlight .code .hljs-formula{background:#eee8d5}.post .post-content .highlight .code .hljs-emphasis{font-style:italic}.post .post-content .highlight .code .hljs-strong{font-weight:700}.post .post-content .post-summary{margin-bottom:1em}.post .post-content .read-more .read-more-link{float:right;color:#c05b4d;font-size:1.1em;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.post .post-content .read-more .read-more-link:hover{border-bottom:1px solid #c05b4d}.post .post-content kbd{display:inline-block;padding:.25em;background-color:#fafafa;border:1px solid #dbdbdb;border-bottom-color:#b5b5b5;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 #b5b5b5;box-shadow:inset 0 -1px 0 #b5b5b5;font-size:.8em;line-height:1.25;font-family:SFMono-Regular,Liberation Mono,Roboto Mono,Menlo,Monaco,Consolas,Courier New,Courier,monospace;color:#4a4a4a}.post .post-content dl dt:after{content:":"}.post .post-content figure.center{text-align:center}.post .post-content figure figcaption h4{color:#b5b5b5;font-size:.9rem}.post .post-content .task-list{list-style:none;padding-left:1.5rem}.post .post-copyright{margin-top:20px;padding-top:10px;border-top:1px dashed #e6e6e6}.post .post-copyright .copyright-item{margin:5px 0}.post .post-copyright .copyright-item a{color:#c05b4d;word-wrap:break-word}.post .post-copyright .copyright-item a:hover{border-bottom:1px solid #c05b4d}.post .post-copyright .copyright-item .item-title{display:inline-block;min-width:5rem;margin-right:.5rem;text-align:right}.post .post-copyright .copyright-item .item-title:after{content:" :"}.post .post-reward{margin-top:20px;padding-top:10px;text-align:center;border-top:1px dashed #e6e6e6}.post .post-reward .reward-button{margin:15px 0;padding:3px 7px;display:inline-block;color:#c05b4d;border:1px solid #c05b4d;border-radius:5px;cursor:pointer}.post .post-reward .reward-button:hover{color:#fefefe;background-color:#c05b4d;-webkit-transition:.5s;transition:.5s}.post .post-reward #reward:checked~.qr-code{display:block}.post .post-reward #reward:checked~.reward-button,.post .post-reward .qr-code{display:none}.post .post-reward .qr-code .qr-code-image{display:inline-block;min-width:200px;width:40%;margin-top:15px}.post .post-reward .qr-code .qr-code-image span{display:inline-block;width:100%;margin:8px 0}.post .post-reward .qr-code .image{width:200px;height:200px}.post .post-footer{margin-top:20px;margin-bottom:40px;border-top:1px solid #e6e6e6;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.post .post-footer .post-tags{padding:15px 0}.post .post-footer .post-tags a{margin-right:5px;color:#c05b4d;word-break:break-all}.post .post-footer .post-tags a:before{content:"#"}.post .post-footer .post-nav{margin:1em 0}.post .post-footer .post-nav:after,.post .post-footer .post-nav:before{content:" ";display:table}.post .post-footer .post-nav:after{clear:both}.post .post-footer .post-nav .next,.post .post-footer .post-nav .prev{font-weight:600;font-size:18px;font-family:Athelas,STHeiti,Microsoft Yahei,serif;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;-webkit-transition-duration:.3s;transition-duration:.3s}.post .post-footer .post-nav .prev{float:left}.post .post-footer .post-nav .prev:hover{color:#c05b4d;-webkit-transform:translateX(-4px);-ms-transform:translateX(-4px);transform:translateX(-4px)}.post .post-footer .post-nav .next{float:right}.post .post-footer .post-nav .next:hover{color:#c05b4d;-webkit-transform:translateX(4px);-ms-transform:translateX(4px);transform:translateX(4px)}.post .post-footer .post-nav .nav-mobile{display:none}@media screen and (max-width:60em){.post .post-footer .post-nav .nav-default{display:none}.post .post-footer .post-nav .nav-mobile{display:inline}}.post .disqus-button{display:block;padding:15px 0;font-size:16px;color:#555;border:1px solid #ddd;text-align:center;cursor:pointer}@media screen and (max-width:504px){.post{padding:2em 1em}.content-wrapper{padding:0}}@media screen and (min-width:800px){.post{margin:0 5em 3em}}.pagination{margin:2em 0}.pagination:after,.pagination:before{content:" ";display:table}.pagination:after{clear:both}.pagination .next,.pagination .prev{font-weight:600;font-size:20px;font-family:Athelas,STHeiti,Microsoft Yahei,serif;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;-webkit-transition-duration:.3s;transition-duration:.3s}.pagination .prev{float:left}.pagination .prev:hover{color:#c05b4d;-webkit-transform:translateX(-4px);-ms-transform:translateX(-4px);transform:translateX(-4px)}.pagination .next{float:right}.pagination .next:hover{color:#c05b4d;-webkit-transform:translateX(4px);-ms-transform:translateX(4px);transform:translateX(4px)}.footer{margin-top:2em}.footer .social-links{text-align:center}.footer .social-links .iconfont{font-size:30px}.footer .social-links .iconfont+.iconfont{margin-left:10px}.footer .social-links .iconfont:hover{color:#c05b4d}.footer .copyright{margin:10px 0;color:#8a8a8a;text-align:center;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.footer .copyright .hexo-link,.footer .copyright .theme-link{color:#c05b4d}.footer .copyright .copyright-year{display:block}.footer .copyright .copyright-year .heart{font-size:14px}.archive{margin:0 5em 3em;background-color:#fff;padding:1em 5em 5em}.archive .archive-title{font-family:Athelas,STHeiti,Microsoft Yahei,serif}.archive .archive-title.category,.archive .archive-title.tag{margin:20px 0}.archive .archive-title .archive-name{margin:0;display:inline-block;font-weight:400;font-size:30px;line-height:32px}.archive .archive-title .archive-post-counter{display:none;color:#8a8a8a}.archive .collection-title{font-family:Athelas,STHeiti,Microsoft Yahei,serif}.archive .collection-title .archive-year{margin:2em 0 0;font-weight:400;font-size:28px;line-height:30px}.archive .archive-post{padding:15px 20px 5px;border-bottom:1px solid #cacaca;font-size:1.1em}.archive .archive-post .archive-post-time{margin-right:50px;color:#8a8a8a}.archive .archive-post .archive-post-title .archive-post-link{color:#c05b4d}.archive .archive-post::first-child{margin-top:10px}.archive .archive-post:hover{-webkit-transition:.2s ease-out;transition:.2s ease-out;-webkit-transform:translateX(4px);-ms-transform:translateX(4px);transform:translateX(4px)}.archive .archive-post:hover .archive-post-time{color:#717171}.archive .archive-post:hover .archive-post-title .archive-post-link{color:#a14639}.archive .more-post .more-post-link{margin-top:1em;float:right;color:#c05b4d;font-size:1.1em;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.archive .more-post .more-post-link:hover{border-bottom:1px solid #c05b4d}@media screen and (max-width:60em){.archive{margin-left:auto;margin-right:auto;padding:1em}.archive .archive-title .archive-name{font-size:26px}.archive .collection-title .archive-year{margin:10px 0;font-size:24px}.archive .archive-post{padding:5px 10px}.archive .archive-post .archive-post-time{font-size:13px;display:block}}.tag-cloud{margin:2em 0 3em;text-align:center;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.tag-cloud .tag-cloud-title{display:inline-block;font-size:24px;color:#c05b4d;border-bottom:2px solid #c05b4d}.tag-cloud .tag-cloud-tags{margin:10px 0}.tag-cloud .tag-cloud-tags a{display:inline-block;position:relative;margin:5px 10px;word-wrap:break-word;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.tag-cloud .tag-cloud-tags a .tag-count{display:inline-block;position:relative;top:-8px;right:-2px;color:#c05b4d;font-size:12px}.tag-cloud .tag-cloud-tags a:active,.tag-cloud .tag-cloud-tags a:focus,.tag-cloud .tag-cloud-tags a:hover{color:#c05b4d;-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.categories{margin:2em 0 3em;text-align:center;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.categories .categories-title{display:inline-block;font-size:18px;color:#c05b4d;border-bottom:2px solid #c05b4d}.categories .categories-tags{margin:10px 0}.categories .categories-tags .category-link{display:inline-block;position:relative;margin:5px 10px;word-wrap:break-word;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.categories .categories-tags .category-link .category-count{display:inline-block;position:relative;top:-8px;right:-2px;color:#c05b4d;font-size:12px}.categories .categories-tags .category-link:active,.categories .categories-tags .category-link:focus,.categories .categories-tags .category-link:hover{color:#c05b4d;-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.slideout-menu{position:fixed;top:0;left:0;bottom:0;width:180px;min-height:100vh;overflow-y:hidden;-webkit-overflow-scrolling:touch;z-index:0;display:none}.slideout-panel{position:relative;z-index:1;background-color:#fefefe;min-height:100%}.slideout-open,.slideout-open .slideout-panel,.slideout-open body{overflow:hidden}.slideout-open .slideout-menu{display:block}.mobile-navbar{display:none;position:fixed;top:0;left:0;width:100%;height:50px;background:#fefefe;-webkit-box-shadow:0 2px 2px #cacaca;box-shadow:0 2px 2px #cacaca;text-align:center;-webkit-transition:-webkit-transform .3s ease;transition:-webkit-transform .3s ease;transition:transform .3s ease;transition:transform .3s ease,-webkit-transform .3s ease;z-index:99}.mobile-navbar.fixed-open{-webkit-transform:translate3d(180px,0,0);transform:translate3d(180px,0,0)}.mobile-navbar .mobile-header-logo{display:inline-block;margin-right:50px}.mobile-navbar .mobile-header-logo .logo{font-size:22px;line-height:50px;font-family:Chancery,cursive}.mobile-navbar .mobile-navbar-icon{color:#c05b4d;height:50px;width:50px;font-size:24px;text-align:center;float:left;position:relative;-webkit-transition:background .5s;transition:background .5s}@-webkit-keyframes clickfirst{0%{-webkit-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}to{-webkit-transform:translateY(0) rotate(45deg);transform:translateY(0) rotate(45deg)}}@keyframes clickfirst{0%{-webkit-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}to{-webkit-transform:translateY(0) rotate(45deg);transform:translateY(0) rotate(45deg)}}@-webkit-keyframes clickmid{0%{opacity:1}to{opacity:0}}@keyframes clickmid{0%{opacity:1}to{opacity:0}}@-webkit-keyframes clicklast{0%{-webkit-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}to{-webkit-transform:translateY(0) rotate(-45deg);transform:translateY(0) rotate(-45deg)}}@keyframes clicklast{0%{-webkit-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}to{-webkit-transform:translateY(0) rotate(-45deg);transform:translateY(0) rotate(-45deg)}}@-webkit-keyframes outfirst{0%{-webkit-transform:translateY(0) rotate(-45deg);transform:translateY(0) rotate(-45deg)}to{-webkit-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}}@keyframes outfirst{0%{-webkit-transform:translateY(0) rotate(-45deg);transform:translateY(0) rotate(-45deg)}to{-webkit-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}}@-webkit-keyframes outmid{0%{opacity:0}to{opacity:1}}@keyframes outmid{0%{opacity:0}to{opacity:1}}@-webkit-keyframes outlast{0%{-webkit-transform:translateY(0) rotate(45deg);transform:translateY(0) rotate(45deg)}to{-webkit-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}}@keyframes outlast{0%{-webkit-transform:translateY(0) rotate(45deg);transform:translateY(0) rotate(45deg)}to{-webkit-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}}.mobile-navbar .mobile-navbar-icon span{position:absolute;left:15px;top:25px;left:calc((100% - 20px) / 2);top:calc((100% - 1px) / 2);width:20px;height:1px;background-color:#c05b4d}.mobile-navbar .mobile-navbar-icon span:first-child{-webkit-transform:translateY(6px) rotate(0deg);-ms-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}.mobile-navbar .mobile-navbar-icon span:nth-child(3){-webkit-transform:translateY(-6px) rotate(0deg);-ms-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}.mobile-navbar .mobile-navbar-icon.icon-click span:first-child{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:clickfirst;animation-name:clickfirst}.mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(2){-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:clickmid;animation-name:clickmid}.mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(3){-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:clicklast;animation-name:clicklast}.mobile-navbar .mobile-navbar-icon.icon-out span:first-child{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:outfirst;animation-name:outfirst}.mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(2){-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:outmid;animation-name:outmid}.mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(3){-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:outlast;animation-name:outlast}.mobile-menu{background-color:hsla(45,46%,95%,.5)}.mobile-menu .mobile-menu-list{position:relative;list-style:none;margin-top:50px;padding:0;border-top:1px solid #f8f5ec}.mobile-menu .mobile-menu-list .mobile-menu-item{padding:10px 30px;border-bottom:1px solid #f8f5ec}.mobile-menu .mobile-menu-list a{font-size:18px;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.mobile-menu .mobile-menu-list a:hover{color:#c05b4d}@media screen and (max-width:60em){.mobile-navbar{display:block}}.back-to-top{display:none;position:fixed;right:20px;bottom:20px;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;-webkit-transition-duration:.3s;transition-duration:.3s;z-index:10}.back-to-top:hover{-webkit-transform:translateY(-5px);-ms-transform:translateY(-5px);transform:translateY(-5px)}@media screen and (max-width:60em){.back-to-top{display:none!important}}.not-found{text-align:center}.not-found .error-emoji{color:#363636;font-size:3rem}.not-found .error-text{color:#797979;font-size:1.25rem}.not-found .error-link{margin-top:2rem}.not-found .error-link a{color:#c05b4d}
+/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}html{font-size:18px;-webkit-box-sizing:border-box;box-sizing:border-box}body{padding:0;margin:0;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-weight:400;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.8;color:#34495e;background:#fefefe;scroll-behavior:smooth}@media screen and (max-width:1080px){body{border-top:0}}::-moz-selection{background:#c05b4d;color:#fff}::selection{background:#c05b4d;color:#fff}img{max-width:100%;height:auto;display:inline-block;vertical-align:middle}a{color:#34495e;text-decoration:none}h1{font-size:1.6em}h1,h2{font-family:Athelas,STHeiti,Microsoft Yahei,serif}h2{font-size:1.5em}h3{font-size:1.3em}h3,h4{font-family:Athelas,STHeiti,Microsoft Yahei,serif}h4{font-size:1.2em}h5{font-size:1.1em}h5,h6{font-family:Athelas,STHeiti,Microsoft Yahei,serif}h6{font-size:1em}.container{margin:0 auto;width:1080px}@media screen and (max-width:1080px){.container{width:100%}}.content-wrapper{padding:3em 0 1px}.video-container{position:relative;padding-bottom:56.25%;padding-top:25px;height:0}.video-container iframe{position:absolute;top:0;left:0;width:100%;height:100%}.bg-llight{background-color:#f2f2f5}.bg-white{background-color:#fff}@font-face{font-family:iconfont;src:url(fonts/iconfont/iconfont.eot?hash=c2af3bb);src:url(fonts/iconfont/iconfont.eot?hash=c2af3bb#iefix) format("embedded-opentype"),url(fonts/iconfont/iconfont.woff?hash=5d21a10) format("woff"),url(fonts/iconfont/iconfont.ttf?hash=0e6028a) format("truetype"),url(fonts/iconfont/iconfont.svg?hash=566e23f#iconfont) format("svg")}.iconfont{font-family:iconfont!important;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale;cursor:pointer}.icon-instagram:before{font-size:.95em;content:"\E611";position:relative;top:-1px}.icon-douban:before{content:"\E610"}.icon-tumblr:before{content:"\E69F";font-size:.85em;position:relative;top:-4px}.icon-linkedin:before{content:"\E60D";position:relative;top:-4px}.icon-twitter:before{content:"\E600"}.icon-weibo:before{content:"\E602"}.icon-stack-overflow:before{content:"\E603";font-size:.85em;position:relative;top:-4px}.icon-email:before{content:"\E605";position:relative;top:-2px}.icon-facebook:before{content:"\E601";font-size:.95em;position:relative;top:-2px}.icon-github:before{content:"\E606";position:relative;top:-3px}.icon-rss:before{content:"\E604"}.icon-google:before{content:"\E609"}.icon-zhihu:before{content:"\E607";font-size:.9em;position:relative;top:-2px}.icon-pocket:before{content:"\E856"}.icon-heart:before{content:"\E608"}.icon-right:before{content:"\E60A"}.icon-left:before{content:"\E60B"}.icon-up:before{content:"\E60C"}.icon-close:before{content:"\E60F"}.header:after,.header:before{content:" ";display:table}.header:after{clear:both}.header .logo-wrapper{float:left;padding-left:15px}.header .logo-wrapper .logo{font-size:36px;font-family:Chancery,cursive}@media screen and (max-width:1080px){.header .logo-wrapper{display:none}}.header .site-navbar .menu{float:right;padding-right:15px;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.header .site-navbar .menu .menu-item{margin-left:1em;margin-right:1em;display:inline-block;vertical-align:middle;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-box-shadow:0 0 1px transparent;box-shadow:0 0 1px transparent;position:relative;overflow:hidden}.header .site-navbar .menu .menu-item+.menu-item{margin-left:10px}.header .site-navbar .menu .menu-item:before{content:"";position:absolute;z-index:-1;height:2px;bottom:0;left:51%;right:51%;background:#c05b4d;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-property:right,left;transition-property:right,left;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.header .site-navbar .menu .menu-item.active:before,.header .site-navbar .menu .menu-item:active:before,.header .site-navbar .menu .menu-item:focus:before,.header .site-navbar .menu .menu-item:hover:before{right:0;left:0}.header .site-navbar .menu .menu-item-link{font-size:18px}@media screen and (max-width:1080px){.header .site-navbar{display:none}}@media screen and (max-width:1080px){.header{padding:50px 0 0;text-align:center}}.post{padding:3em 5em;margin:0 5em 3em}.post .post-header{margin-bottom:20px;text-align:center;padding-bottom:10px;border-bottom:2px solid #d3d3d3}.post .post-header .post-title{margin:0;font-size:1.8em;font-weight:400;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.post .post-header .post-link{display:inline-block;vertical-align:middle;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-box-shadow:0 0 1px transparent;box-shadow:0 0 1px transparent;position:relative;overflow:hidden}.post .post-header .post-link:before{content:"";position:absolute;z-index:-1;height:2px;bottom:0;left:51%;right:51%;background:#c05b4d;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-property:right,left;transition-property:right,left;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.post .post-header .post-link.active:before,.post .post-header .post-link:active:before,.post .post-header .post-link:focus:before,.post .post-header .post-link:hover:before{right:0;left:0}.post .post-header .post-meta{font-size:14px;color:#8a8a8a}.post .post-header .post-meta .post-time{font-size:15px}.post .post-header .post-meta .post-category{display:inline}.post .post-header .post-meta .post-category a{color:inherit}.post .post-header .post-meta .post-category a:before{content:"\B7"}.post .post-header .post-meta .post-category a:hover{color:#c05b4d}.post .post-header .post-meta .more-meta:before{content:"\B7"}.post .post-toc{padding:10px;font-family:Athelas,STHeiti,Microsoft Yahei,serif;border-bottom:2px solid #d3d3d3;word-wrap:break-word}.post .post-toc .post-toc-title{margin:0 10px;font-size:20px;font-weight:400;text-transform:uppercase}.post .post-toc .post-toc-content{font-size:15px}.post .post-toc .post-toc-content.always-active ul{display:block}.post .post-toc .post-toc-content>nav>ul{margin:10px 0}.post .post-toc .post-toc-content ul{padding-left:20px;list-style:square}.post .post-toc .post-toc-content ul li>a{color:#139}.post .post-toc .post-toc-content ul li>a:hover{color:#900}.post .post-toc .post-toc-content ul ul{list-style:circle}.post .post-toc .post-toc-content .toc-link.active{color:#c05b4d}.post .post-content{word-wrap:break-word}.post .post-content h1,.post .post-content h2,.post .post-content h3,.post .post-content h4,.post .post-content h5,.post .post-content h6{font-weight:600;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.post .post-content h1,.post .post-content h2{border-bottom:1px solid #ddd;margin-top:2em}.post .post-content h3{margin-top:1.5em}.post .post-content a{color:#c05b4d;word-break:break-all}.post .post-content a:hover{border-bottom:1px solid #c05b4d}.post .post-content a.fancybox{border:0}.post .post-content blockquote{margin:1em 0;padding:1px 20px;position:relative;color:rgba(52,73,94,.8);background-color:rgba(192,91,77,.05);border-left:3px solid rgba(192,91,77,.3);-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.125);box-shadow:1px 1px 2px rgba(0,0,0,.125)}.post .post-content blockquote footer,.post .post-content blockquote p{margin:.5em 0}.post .post-content blockquote cite:before{content:"\2014";padding-right:.3em;padding-left:.3em;color:#aaa}.post .post-content img{display:inline-block;max-width:100%}.post .post-content>table{max-width:100%;margin:10px 0;border-spacing:0;-webkit-box-shadow:2px 2px 3px rgba(0,0,0,.125);box-shadow:2px 2px 3px rgba(0,0,0,.125)}.post .post-content>table thead{background:#f8f5ec}.post .post-content>table td,.post .post-content>table th{padding:5px 15px;border:1px double #f4efe1}.post .post-content>table tr:hover{background-color:#f8f5ec}.post .post-content code,.post .post-content pre{padding:7px;font-size:13px;font-family:Consolas,Monaco,Menlo,monospace;background:#f8f5ec}.post .post-content code{padding:3px 5px;border-radius:4px;color:#c7254e}.post .post-content .highlight{margin:1em 0;border-radius:5px;overflow-x:auto;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.125);box-shadow:1px 1px 2px rgba(0,0,0,.125);position:relative}.post .post-content .highlight table{position:relative}.post .post-content .highlight table:after{position:absolute;top:0;right:0;left:0;padding:2px 7px;font-size:13px;font-weight:700;color:#b1b1b1;background:#f4efe1;content:"Code"}.post .post-content .highlight.language-bash>table:after{content:"Bash"}.post .post-content .highlight.language-c>table:after{content:"C"}.post .post-content .highlight.language-cs>table:after{content:"C#"}.post .post-content .highlight.language-cpp>table:after{content:"C++"}.post .post-content .highlight.language-css>table:after{content:"CSS"}.post .post-content .highlight.language-coffeescript>table:after{content:"CoffeeScript"}.post .post-content .highlight.language-html>table:after{content:"HTML"}.post .post-content .highlight.language-xml>table:after{content:"XML"}.post .post-content .highlight.language-http>table:after{content:"HTTP"}.post .post-content .highlight.language-json>table:after{content:"JSON"}.post .post-content .highlight.language-java>table:after{content:"Java"}.post .post-content .highlight.language-javascript>table:after,.post .post-content .highlight.language-js>table:after{content:"JavaScript"}.post .post-content .highlight.language-makefile>table:after{content:"Makefile"}.post .post-content .highlight.language-markdown>table:after{content:"Markdown"}.post .post-content .highlight.language-objectivec>table:after{content:"Objective-C"}.post .post-content .highlight.language-php>table:after{content:"PHP"}.post .post-content .highlight.language-perl>table:after{content:"Perl"}.post .post-content .highlight.language-python>table:after{content:"Python"}.post .post-content .highlight.language-ruby>table:after{content:"Ruby"}.post .post-content .highlight.language-sql>table:after{content:"SQL"}.post .post-content .highlight.language-shell>table:after{content:"Shell"}.post .post-content .highlight.language-erlang>table:after{content:"Erlang"}.post .post-content .highlight.language-go>table:after{content:"Go"}.post .post-content .highlight.language-groovy>table:after{content:"Groovy"}.post .post-content .highlight.language-haskell>table:after{content:"Haskell"}.post .post-content .highlight.language-kotlin>table:after{content:"Kotlin"}.post .post-content .highlight.language-less>table:after{content:"Less"}.post .post-content .highlight.language-lisp>table:after{content:"Lisp"}.post .post-content .highlight.language-lua>table:after{content:"Lua"}.post .post-content .highlight.language-matlab>table:after{content:"Matlab"}.post .post-content .highlight.language-rust>table:after{content:"Rust"}.post .post-content .highlight.language-scss>table:after{content:"Scss"}.post .post-content .highlight.language-scala>table:after{content:"Scala"}.post .post-content .highlight.language-swift>table:after{content:"Swift"}.post .post-content .highlight.language-typescript>table:after{content:"TypeScript"}.post .post-content .highlight.language-yaml>table:after,.post .post-content .highlight.language-yml>table:after{content:"YAML"}.post .post-content .highlight.language-toml>table:after{content:"TOML"}.post .post-content .highlight .code pre{margin:0;padding:30px 10px 10px}.post .post-content .highlight .gutter{width:10px;color:#cacaca}.post .post-content .highlight .gutter pre{margin:0;padding:30px 7px 10px}.post .post-content .highlight .line{height:20px}.post .post-content .highlight table,.post .post-content .highlight td,.post .post-content .highlight tr{margin:0;padding:0;width:100%;border-collapse:collapse}.post .post-content .highlight .code .hljs-comment,.post .post-content .highlight .code .hljs-quote{color:#93a1a1}.post .post-content .highlight .code .hljs-addition,.post .post-content .highlight .code .hljs-keyword,.post .post-content .highlight .code .hljs-selector-tag{color:#859900}.post .post-content .highlight .code .hljs-doctag,.post .post-content .highlight .code .hljs-literal,.post .post-content .highlight .code .hljs-meta .hljs-meta-string,.post .post-content .highlight .code .hljs-number,.post .post-content .highlight .code .hljs-regexp,.post .post-content .highlight .code .hljs-string{color:#2aa198}.post .post-content .highlight .code .hljs-name,.post .post-content .highlight .code .hljs-section,.post .post-content .highlight .code .hljs-selector-class,.post .post-content .highlight .code .hljs-selector-id,.post .post-content .highlight .code .hljs-title{color:#268bd2}.post .post-content .highlight .code .hljs-attr,.post .post-content .highlight .code .hljs-attribute,.post .post-content .highlight .code .hljs-class .hljs-title,.post .post-content .highlight .code .hljs-template-variable,.post .post-content .highlight .code .hljs-type,.post .post-content .highlight .code .hljs-variable{color:#b58900}.post .post-content .highlight .code .hljs-bullet,.post .post-content .highlight .code .hljs-link,.post .post-content .highlight .code .hljs-meta,.post .post-content .highlight .code .hljs-meta .hljs-keyword,.post .post-content .highlight .code .hljs-selector-attr,.post .post-content .highlight .code .hljs-selector-pseudo,.post .post-content .highlight .code .hljs-subst,.post .post-content .highlight .code .hljs-symbol{color:#cb4b16}.post .post-content .highlight .code .hljs-built_in,.post .post-content .highlight .code .hljs-deletion{color:#dc322f}.post .post-content .highlight .code .hljs-formula{background:#eee8d5}.post .post-content .highlight .code .hljs-emphasis{font-style:italic}.post .post-content .highlight .code .hljs-strong{font-weight:700}.post .post-content .post-summary{margin-bottom:1em}.post .post-content .read-more{text-align:right}.post .post-content .read-more .read-more-link{color:#c05b4d;font-size:1.1em;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.post .post-content .read-more .read-more-link:hover{border-bottom:1px solid #c05b4d}.post .post-content kbd{display:inline-block;padding:.25em;background-color:#fafafa;border:1px solid #dbdbdb;border-bottom-color:#b5b5b5;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 #b5b5b5;box-shadow:inset 0 -1px 0 #b5b5b5;font-size:.8em;line-height:1.25;font-family:SFMono-Regular,Liberation Mono,Roboto Mono,Menlo,Monaco,Consolas,Courier New,Courier,monospace;color:#4a4a4a}.post .post-content dl dt:after{content:":"}.post .post-content figure.center{text-align:center}.post .post-content figure figcaption h4{color:#b5b5b5;font-size:.9rem}.post .post-content .task-list{list-style:none;padding-left:1.5rem}.post .post-copyright{margin-top:20px;padding-top:10px;border-top:1px dashed #e6e6e6}.post .post-copyright .copyright-item{margin:5px 0}.post .post-copyright .copyright-item a{color:#c05b4d;word-wrap:break-word}.post .post-copyright .copyright-item a:hover{border-bottom:1px solid #c05b4d}.post .post-copyright .copyright-item .item-title{display:inline-block;min-width:5rem;margin-right:.5rem;text-align:right}.post .post-copyright .copyright-item .item-title:after{content:" :"}.post .post-reward{margin-top:20px;padding-top:10px;text-align:center;border-top:1px dashed #e6e6e6}.post .post-reward .reward-button{margin:15px 0;padding:3px 7px;display:inline-block;color:#c05b4d;border:1px solid #c05b4d;border-radius:5px;cursor:pointer}.post .post-reward .reward-button:hover{color:#fefefe;background-color:#c05b4d;-webkit-transition:.5s;transition:.5s}.post .post-reward #reward:checked~.qr-code{display:block}.post .post-reward #reward:checked~.reward-button,.post .post-reward .qr-code{display:none}.post .post-reward .qr-code .qr-code-image{display:inline-block;min-width:200px;width:40%;margin-top:15px}.post .post-reward .qr-code .qr-code-image span{display:inline-block;width:100%;margin:8px 0}.post .post-reward .qr-code .image{width:200px;height:200px}.post .post-footer{margin-top:20px;margin-bottom:40px;border-top:1px solid #e6e6e6;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.post .post-footer .post-tags{padding:15px 0}.post .post-footer .post-tags a{margin-right:5px;color:#c05b4d;word-break:break-all}.post .post-footer .post-tags a:before{content:"#"}.post .post-footer .post-nav{margin:1em 0}.post .post-footer .post-nav:after,.post .post-footer .post-nav:before{content:" ";display:table}.post .post-footer .post-nav:after{clear:both}.post .post-footer .post-nav .next,.post .post-footer .post-nav .prev{font-weight:600;font-size:18px;font-family:Athelas,STHeiti,Microsoft Yahei,serif;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;-webkit-transition-duration:.3s;transition-duration:.3s}.post .post-footer .post-nav .prev{float:left}.post .post-footer .post-nav .prev:hover{color:#c05b4d;-webkit-transform:translateX(-4px);-ms-transform:translateX(-4px);transform:translateX(-4px)}.post .post-footer .post-nav .next{float:right}.post .post-footer .post-nav .next:hover{color:#c05b4d;-webkit-transform:translateX(4px);-ms-transform:translateX(4px);transform:translateX(4px)}.post .post-footer .post-nav .nav-mobile{display:none}@media screen and (max-width:1080px){.post .post-footer .post-nav .nav-default{display:none}.post .post-footer .post-nav .nav-mobile{display:inline}}.post .disqus-button{display:block;padding:15px 0;font-size:16px;color:#555;border:1px solid #ddd;text-align:center;cursor:pointer}@media screen and (max-width:504px){.post{padding:1em;margin:0 0 2em}.content-wrapper{padding:1em 0 1px}}@media screen and (min-width:900px) and (max-width:1080px){.post{margin:0 2em 2em}.content-wrapper{padding:2em 0 1px}}@media screen and (min-width:504px) and (max-width:899px){.post{padding:1em;margin:0 1em 2em}.content-wrapper{padding:1em 0 1px}}.pagination{margin:2em 0;text-align:center}.pagination:after,.pagination:before{content:" ";display:table}.pagination:after{clear:both}.pagination li{display:inline-block}.pagination li a{background-color:#fff;margin-left:.1em;margin-right:.1em;border:1px solid #222;color:#222;float:left;line-height:1.42857143;padding:6px 12px;position:relative;text-decoration:none;margin-bottom:.2em}.pagination .active a{background-color:#222;border-color:#222;color:#fff;cursor:default;z-index:2}@media screen and (max-width:1080px){.pagination{margin:1em 0}}.footer{margin-top:2em}.footer .social-links{text-align:center}.footer .social-links .iconfont{font-size:30px}.footer .social-links .iconfont+.iconfont{margin-left:10px}.footer .social-links .iconfont:hover{color:#c05b4d}.footer .copyright{margin:10px 0;color:#8a8a8a;text-align:center;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.footer .copyright .hexo-link,.footer .copyright .theme-link{color:#c05b4d}.footer .copyright .copyright-year{display:block}.footer .copyright .copyright-year .heart{font-size:14px}.archive{margin:0 5em 3em;background-color:#fff;padding:1em 5em 5em}.archive .archive-title{font-family:Athelas,STHeiti,Microsoft Yahei,serif}.archive .archive-title.category,.archive .archive-title.tag{margin:20px 0}.archive .archive-title .archive-name{margin:0;display:inline-block;font-weight:400;font-size:30px;line-height:32px}.archive .archive-title .archive-post-counter{display:none;color:#8a8a8a}.archive .collection-title{font-family:Athelas,STHeiti,Microsoft Yahei,serif}.archive .collection-title .archive-year{margin:2em 0 0;font-weight:400;font-size:28px;line-height:30px}.archive .archive-post{padding:15px 20px 5px;border-bottom:1px solid #cacaca;font-size:1.1em}.archive .archive-post .archive-post-time{margin-right:50px;color:#8a8a8a}.archive .archive-post .archive-post-title .archive-post-link{color:#c05b4d}.archive .archive-post::first-child{margin-top:10px}.archive .archive-post:hover{-webkit-transition:.2s ease-out;transition:.2s ease-out;-webkit-transform:translateX(4px);-ms-transform:translateX(4px);transform:translateX(4px)}.archive .archive-post:hover .archive-post-time{color:#717171}.archive .archive-post:hover .archive-post-title .archive-post-link{color:#a14639}.archive .more-post{text-align:right}.archive .more-post .more-post-link{margin-top:1em;color:#c05b4d;font-size:1.1em;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.archive .more-post .more-post-link:hover{border-bottom:1px solid #c05b4d}@media screen and (max-width:899px){.archive{margin:0 auto 1em;padding:1em}.archive .archive-title .archive-name{font-size:26px}.archive .collection-title .archive-year{margin:10px 0;font-size:24px}.archive .archive-post{padding:5px 10px}.archive .archive-post .archive-post-time{font-size:13px;display:block}}.tag-cloud{margin:2em 0 3em;text-align:center;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.tag-cloud .tag-cloud-title{display:inline-block;font-size:24px;color:#c05b4d;border-bottom:2px solid #c05b4d}.tag-cloud .tag-cloud-tags{margin:10px 0}.tag-cloud .tag-cloud-tags a{display:inline-block;position:relative;margin:5px 10px;word-wrap:break-word;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.tag-cloud .tag-cloud-tags a .tag-count{display:inline-block;position:relative;top:-8px;right:-2px;color:#c05b4d;font-size:12px}.tag-cloud .tag-cloud-tags a:active,.tag-cloud .tag-cloud-tags a:focus,.tag-cloud .tag-cloud-tags a:hover{color:#c05b4d;-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.categories{margin:2em 0 3em;text-align:center;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.categories .categories-title{display:inline-block;font-size:18px;color:#c05b4d;border-bottom:2px solid #c05b4d}.categories .categories-tags{margin:10px 0}.categories .categories-tags .category-link{display:inline-block;position:relative;margin:5px 10px;word-wrap:break-word;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.categories .categories-tags .category-link .category-count{display:inline-block;position:relative;top:-8px;right:-2px;color:#c05b4d;font-size:12px}.categories .categories-tags .category-link:active,.categories .categories-tags .category-link:focus,.categories .categories-tags .category-link:hover{color:#c05b4d;-webkit-transform:scale(1.1);-ms-transform:scale(1.1);transform:scale(1.1)}.slideout-menu{position:fixed;top:0;left:0;bottom:0;width:180px;min-height:100vh;overflow-y:hidden;-webkit-overflow-scrolling:touch;z-index:0;display:none}.slideout-panel{position:relative;z-index:1;background-color:#fefefe;min-height:100%}.slideout-open,.slideout-open .slideout-panel,.slideout-open body{overflow:hidden}.slideout-open .slideout-menu{display:block}.mobile-navbar{display:none;position:fixed;top:0;left:0;width:100%;height:50px;background:#fefefe;-webkit-box-shadow:0 2px 2px #cacaca;box-shadow:0 2px 2px #cacaca;text-align:center;-webkit-transition:-webkit-transform .3s ease;transition:-webkit-transform .3s ease;transition:transform .3s ease;transition:transform .3s ease,-webkit-transform .3s ease;z-index:99}.mobile-navbar.fixed-open{-webkit-transform:translate3d(180px,0,0);transform:translate3d(180px,0,0)}.mobile-navbar .mobile-header-logo{display:inline-block;margin-right:50px}.mobile-navbar .mobile-header-logo .logo{font-size:22px;line-height:50px;font-family:Chancery,cursive}.mobile-navbar .mobile-navbar-icon{color:#c05b4d;height:50px;width:50px;font-size:24px;text-align:center;float:left;position:relative;-webkit-transition:background .5s;transition:background .5s}@-webkit-keyframes clickfirst{0%{-webkit-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}to{-webkit-transform:translateY(0) rotate(45deg);transform:translateY(0) rotate(45deg)}}@keyframes clickfirst{0%{-webkit-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}to{-webkit-transform:translateY(0) rotate(45deg);transform:translateY(0) rotate(45deg)}}@-webkit-keyframes clickmid{0%{opacity:1}to{opacity:0}}@keyframes clickmid{0%{opacity:1}to{opacity:0}}@-webkit-keyframes clicklast{0%{-webkit-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}to{-webkit-transform:translateY(0) rotate(-45deg);transform:translateY(0) rotate(-45deg)}}@keyframes clicklast{0%{-webkit-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}to{-webkit-transform:translateY(0) rotate(-45deg);transform:translateY(0) rotate(-45deg)}}@-webkit-keyframes outfirst{0%{-webkit-transform:translateY(0) rotate(-45deg);transform:translateY(0) rotate(-45deg)}to{-webkit-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}}@keyframes outfirst{0%{-webkit-transform:translateY(0) rotate(-45deg);transform:translateY(0) rotate(-45deg)}to{-webkit-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}}@-webkit-keyframes outmid{0%{opacity:0}to{opacity:1}}@keyframes outmid{0%{opacity:0}to{opacity:1}}@-webkit-keyframes outlast{0%{-webkit-transform:translateY(0) rotate(45deg);transform:translateY(0) rotate(45deg)}to{-webkit-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}}@keyframes outlast{0%{-webkit-transform:translateY(0) rotate(45deg);transform:translateY(0) rotate(45deg)}to{-webkit-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}}.mobile-navbar .mobile-navbar-icon span{position:absolute;left:15px;top:25px;left:calc((100% - 20px) / 2);top:calc((100% - 1px) / 2);width:20px;height:1px;background-color:#c05b4d}.mobile-navbar .mobile-navbar-icon span:first-child{-webkit-transform:translateY(6px) rotate(0deg);-ms-transform:translateY(6px) rotate(0deg);transform:translateY(6px) rotate(0deg)}.mobile-navbar .mobile-navbar-icon span:nth-child(3){-webkit-transform:translateY(-6px) rotate(0deg);-ms-transform:translateY(-6px) rotate(0deg);transform:translateY(-6px) rotate(0deg)}.mobile-navbar .mobile-navbar-icon.icon-click span:first-child{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:clickfirst;animation-name:clickfirst}.mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(2){-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:clickmid;animation-name:clickmid}.mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(3){-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:clicklast;animation-name:clicklast}.mobile-navbar .mobile-navbar-icon.icon-out span:first-child{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:outfirst;animation-name:outfirst}.mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(2){-webkit-animation-duration:.2s;animation-duration:.2s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:outmid;animation-name:outmid}.mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(3){-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:outlast;animation-name:outlast}.mobile-menu{background-color:hsla(45,46%,95%,.5)}.mobile-menu .mobile-menu-list{position:relative;list-style:none;margin-top:50px;padding:0;border-top:1px solid #f8f5ec}.mobile-menu .mobile-menu-list .mobile-menu-item{padding:10px 30px;border-bottom:1px solid #f8f5ec}.mobile-menu .mobile-menu-list a{font-size:18px;font-family:Athelas,STHeiti,Microsoft Yahei,serif}.mobile-menu .mobile-menu-list a:hover{color:#c05b4d}@media screen and (max-width:1080px){.mobile-navbar{display:block}}.back-to-top{display:none;position:fixed;right:20px;bottom:20px;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;-webkit-transition-duration:.3s;transition-duration:.3s;z-index:10}.back-to-top:hover{-webkit-transform:translateY(-5px);-ms-transform:translateY(-5px);transform:translateY(-5px)}@media screen and (max-width:1080px){.back-to-top{display:none!important}}.not-found{text-align:center}.not-found .error-emoji{color:#363636;font-size:3rem}.not-found .error-text{color:#797979;font-size:1.25rem}.not-found .error-link{margin-top:2rem}.not-found .error-link a{color:#c05b4d}
/*# sourceMappingURL=jane.min.css.map*/ \ No newline at end of file
diff --git a/dist/jane.min.css.map b/dist/jane.min.css.map
index 68c1ab6..2975d47 100644
--- a/dist/jane.min.css.map
+++ b/dist/jane.min.css.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///./css/_variables.scss","webpack:///./css/_common/_normalize.scss","webpack:///./css/style.scss","webpack:///./css/_base.scss","webpack:///./css/_common/_utils.scss","webpack:///./css/_iconfont.scss","webpack:///./css/_partial/_header.scss","webpack:///./css/_partial/_header/_logo.scss","webpack:///./css/_partial/_header/_menu.scss","webpack:///./css/_common/_animation.scss","webpack:///./css/_partial/_post.scss","webpack:///./css/_partial/_post/_header.scss","webpack:///./css/_partial/_post/_toc.scss","webpack:///./css/_partial/_post/_content.scss","webpack:///./css/_partial/_post/_code.scss","webpack:///./css/_partial/_post/_copyright.scss","webpack:///./css/_partial/_post/_reward.scss","webpack:///./css/_partial/_post/_footer.scss","webpack:///./css/_partial/_post/_disqus.scss","webpack:///./css/_partial/_pagination.scss","webpack:///./css/_partial/_footer.scss","webpack:///./css/_partial/_footer/_social.scss","webpack:///./css/_partial/_footer/_copyright.scss","webpack:///./css/_partial/_archive.scss","webpack:///./css/_partial/_tags.scss","webpack:///./css/_partial/_categories.scss","webpack:///./css/_partial/_slideout.scss","webpack:///./css/_partial/_mobile.scss","webpack:///./css/_partial/_back-to-top.scss","webpack:///./css/_partial/_404.scss"],"names":[],"mappings":"AAiFA,WACE,qBACA,kCACA,8QAKA,oBACA,iBAAkB;;AC1FpB,4DAQA,KACE,uBACA,0BACA,6BAA8B,CAqBhC,2FAaE,aAAc,CAQhB,4BAIE,qBACA,uBAAwB,CAQ1B,sBACE,aACA,QAAS,CCQX,kBDEE,YAAa,CAUf,EACE,4BAA6B,CAO/B,iBAEE,SAAU,CAUZ,YACE,wBAAyB,CAO3B,SAEE,eAAiB,CAOnB,IACE,iBAAkB,CAQpB,GACE,cACA,cAAgB,CAOlB,KACE,gBACA,UAAW,CAOb,MACE,aAAc,CAOhB,QAEE,cACA,cACA,kBACA,uBAAwB,CAG1B,IACE,SAAW,CAGb,IACE,aAAe,CAUjB,IACE,QAAS,CAOX,eACE,eAAgB,CAUlB,OACE,eAAgB,CAOlB,GAEE,+BAAuB,uBACvB,QAAS,CAOX,IACE,aAAc,CAOhB,kBAIE,gCACA,aAAc,CAkBhB,sCAKE,cACA,aACA,QAAS,CAOX,OACE,gBAAiB,CAUnB,cAEE,mBAAoB,CAWtB,oEAIE,0BACA,cAAe,CAOjB,sCAEE,cAAe,CAOjB,iDAEE,SACA,SAAU,CAQZ,MACE,kBAAmB,CAWrB,uCAEE,8BAAsB,sBACtB,SAAU,CASZ,4FAEE,WAAY,CASd,mBACE,6BAEA,+BACA,sBAAuB,CASzB,+FAEE,uBAAwB,CAO1B,SACE,wBACA,aACA,0BAA8B,CAQhC,OACE,SACA,SAAU,CAOZ,SACE,aAAc,CAQhB,SACE,eAAiB,CAUnB,MACE,yBACA,gBAAiB,CAGnB,MAEE,SAAU,CEvaZ,KACE,eACA,8BAAsB,sBAGxB,KACE,UACA,SACA,4DACA,gBACA,mCACA,kCACA,gBACA,cACA,mBACA,sBAAuB,CCEtB,mCDGD,KACE,YAAa,CACd,CAGH,iBACE,mBACA,UAAW,CACZ,YAFC,mBACA,UAAW,CAkBb,IACE,eACA,YACA,qBACA,qBAAsB,CAGxB,EACE,cACA,oBAAqB,CAIrB,GACE,eHMO,CGJR,MADC,iDHF+D,CGGhE,GAFC,eHOO,CGLR,GAFC,eHQO,CGNR,MADC,iDHF+D,CGGhE,GAFC,eHSO,CGPR,GAFC,eHUO,CGRR,MADC,iDHF+D,CGGhE,GAFC,aHWK,CGNT,WACE,cACA,UHpBsB,CI7BrB,mCDqDD,WACE,WACA,yEHtCU,CGuCX,CAGH,iBACE,iBAAoB,CAMtB,iBACC,kBACA,sBACA,iBACA,QAAS,CAEV,wBACC,kBACA,MACA,OACA,WACA,WAAY,CAGb,WACE,wBAAyB,CAG3B,UACE,qBAAsB,CEpGxB,WACE,qBAEA,kCACA,wMAG4D,CAU9D,UACE,+BACA,kBACA,mCACA,+BACA,kCACA,cAAe,CAGjB,uBACE,gBACA,gBACA,kBACA,QAAS,CAEX,oBACE,eAAgB,CAElB,oBACE,gBACA,gBACA,kBACA,QAAS,CAEX,sBACE,gBACA,kBACA,QAAS,CAEX,qBACE,eAAgB,CAElB,mBACE,eAAgB,CAElB,4BACE,gBACA,gBACA,kBACA,QAAS,CAEX,mBACE,gBACA,kBACA,QAAS,CAEX,sBACE,gBACA,gBACA,kBACA,QAAS,CAEX,oBACE,gBACA,kBACA,QAAS,CAEX,iBACE,eAAgB,CAElB,oBACE,eAAgB,CAElB,mBACE,gBACA,eACA,kBACA,QAAS,CAEX,oBACE,eAAgB,CAIlB,mBACE,eAAgB,CAElB,mBACE,eAAgB,CAElB,kBACE,eAAgB,CAElB,gBACE,eAAgB,CAElB,mBACE,eAAgB,CACjB,6BD1GG,YACA,aAAc,CAGhB,cACE,UAAW,CEJf,sBCGE,UAAW,CAMZ,4BAHG,eACA,4BPsFoD,COrFrD,mCDRH,sBCaI,YAAa,CACd,4BCZC,YACA,eACA,iDRoD+D,CQnChE,sCAbG,gBACA,iBCZJ,qBACA,sBACA,gCAAwB,wBACxB,mCAA2B,2BAC3B,uCAA+B,+BAC/B,kBACA,eAAgB,CDab,iDAJG,gBRoFoB,CQnFrB,6CCPH,WACA,kBACA,WACA,WACA,SACA,SACA,UACA,mBACA,gCAAyB,wBACzB,uCAAgC,+BAChC,4CAAoC,oCACrC,8MAOG,QACA,MAAO,CACR,2CDPC,cRmFoB,CQlFrB,mCFpBL,qBE0BI,YAAa,CACd,oCFlBD,QACE,iBACA,iBAAkB,CACnB,CIPH,MAEE,gBACA,iBAAkB,CAanB,mBCxBC,mBACA,kBACA,oBACA,+BAAkC,CA4CnC,+BAzCG,SACA,gBACA,gBACA,iDXkD+D,CWjDhE,8BFVD,qBACA,sBACA,gCAAwB,wBACxB,mCAA2B,2BAC3B,uCAA+B,+BAC/B,kBACA,eAAgB,CEQf,qCFLC,WACA,kBACA,WACA,WACA,SACA,SACA,UACA,mBACA,gCAAyB,wBACzB,uCAAgC,+BAChC,4CAAoC,oCCXxC,8KDmBM,QACA,MAAO,CCpBb,8BCSI,eACA,aXkBe,CWUhB,yCAzBG,cAAe,CAChB,6CAGC,cAAe,CAahB,+CAVG,aAAc,CASf,sDANG,aAAa,sDAIb,aXzBU,CW0BX,gDAMD,aAAa,iBCvCnB,aACA,kDACA,gCAIA,oBAAqB,CAkDtB,gCA9CG,cACA,eACA,gBACA,wBAAyB,CAC1B,kCAGC,cZ8ImB,CYxGpB,mDAnCG,aAAc,CACf,yCAGC,aAAc,CACf,qCAGC,kBACA,iBZqIsB,CYhHvB,0CAlBG,UAAW,CACZ,gDAGC,UAAW,CACZ,wCAGC,iBAAkB,CACnB,mDAYD,aZ9Cc,CY+Cf,oBCrDH,oBAAqB,CA4ItB,0IAxIK,gBACA,iDbkD6D,CajD9D,8CAUD,6BACA,cAAe,CAChB,uBAIC,gBAAiB,CAClB,sBAGC,cACA,oBAAqB,CAStB,4BANG,+BbxBc,CayBf,+BAGC,QAAS,CACV,+BAID,aACA,iBACA,kBACA,wBACA,qCACA,yCACA,gDAAyC,wCAgB1C,uEATG,aAAe,CAChB,2CAGC,gBACA,mBACA,kBACA,UAAW,CACZ,wBAID,qBACA,cAAe,CAChB,0BAGC,eACA,cACA,iBACA,gDAAwC,wCAczC,gCAXG,kBbrEsB,CasEvB,0DAGC,iBACA,yBboGgD,CanGjD,mCAGC,wBb9EsB,Ca+EvB,iDCzFH,YACA,eACA,4CACA,kBdO0B,CcN3B,yBAGC,gBACA,kBACA,admLkB,CclLnB,+BAGC,aACA,kBACA,gBACA,gDAAyC,wCACzC,iBAAkB,CAyHnB,qCAtHG,iBAAkB,CAcnB,2CAXG,kBACA,MACA,QACA,OACA,gBACA,eACA,gBACA,cACA,mBACA,cAAe,CAChB,yDAKC,cd6KiB,Cc5KlB,sDADC,Wd8KW,Cc7KZ,uDADC,Yd+Ka,Cc9Kd,wDADC,adgLe,Cc/KhB,wDADC,adiLe,CchLhB,iEADC,sBdkLiC,CcjLlC,yDADC,cdmLiB,CclLlB,wDADC,adoLe,CcnLhB,yDADC,cdqLiB,CcpLlB,yDADC,cdsLiB,CcrLlB,yDADC,cduLiB,CctLlB,sHADC,oBdyL6B,CcxL9B,6DADC,kBd0LyB,CczL1B,6DADC,kBd2LyB,Cc1L1B,+DADC,qBd4L8B,Cc3L/B,wDADC,ad6Le,Cc5LhB,yDADC,cd8LiB,Cc7LlB,2DADC,gBd+LqB,Cc9LtB,yDADC,cdgMiB,Cc/LlB,wDADC,adiMe,CchMhB,0DADC,edkMmB,CcjMpB,2DADC,gBdoMqB,CcnMtB,uDADC,YdqMa,CcpMd,2DADC,gBdsMqB,CcrMtB,4DADC,iBduMuB,CctMxB,2DADC,gBdwMqB,CcvMtB,yDADC,cdyMiB,CcxMlB,yDADC,cd0MiB,CczMlB,wDADC,ad2Me,Cc1MhB,2DADC,gBd4MqB,Cc3MtB,yDADC,cd6MiB,Cc5MlB,yDADC,cd8MiB,Cc7MlB,0DADC,ed+MmB,Cc9MpB,0DADC,edgNmB,Cc/MpB,+DADC,oBdiN6B,CchN9B,iHADC,cdmNiB,CclNlB,yDADC,cdoNiB,CcnNlB,yCAKC,SACA,sBAAuB,CACxB,uCAID,WACA,adhBU,CcsBX,2CAHG,SACA,qBAAsB,CACvB,qCAMD,WAAoC,CACrC,yGAGC,SACA,UACA,WACA,wBAAyB,CAC1B,oGAKG,ad2HY,Cc1Hb,+JAKC,adsHY,CcrHb,6TAQC,ad8GW,Cc7GZ,qQAOC,aduGU,CctGX,mUAQC,ad+Fc,Cc9Ff,uaAUC,adqFW,CcpFZ,wGAIC,adiFa,CchFd,mDAGC,kBd8EY,Cc7Eb,oDAGC,iBAAkB,CACnB,kDAGC,eAAiB,CAClB,kCDzCD,iBAAkB,CACnB,+CAIG,YACA,cACA,gBACA,iDb5C6D,CaiD9D,qDAFG,+BbhGY,CaiGb,wBAKH,qBACA,cACA,yBACA,yBACA,4BACA,kBACA,0CAAkC,kCAClC,eACA,iBACA,2GACA,aAAc,CACf,gCAGC,WAAY,CACb,kCAIG,iBAAkB,CACnB,yCAGC,cACA,eAAiB,CAClB,+BAID,gBACA,mBAAoB,CACrB,sBE/ID,gBACA,iBACA,6BfgCkB,CePnB,sCAtBG,YAAa,CAqBd,wCAlBG,cACA,oBAAqB,CAKtB,8CAFG,+BfFY,CeGb,kDAID,qBACA,eACA,mBACA,gBAAiB,CAKlB,wDAFG,YAAa,CACd,mBCxBL,gBACA,iBACA,kBACA,6BhB+BkB,CgBkBnB,kCA9CG,cACA,gBACA,qBACA,cACA,yBACA,kBACA,cAAe,CAOhB,wCAJG,cACA,yBACA,uBAAgB,eACjB,4CAKC,aAAc,CACf,8EAQD,YAAa,CAmBd,2CAhBG,qBACA,gBACA,UACA,eAAgB,CAOjB,gDAJG,qBACA,WACA,YAAa,CACd,mCAID,YACA,YAAa,CACd,mBC9CH,gBACA,mBACA,6BACA,iDjBoDiE,CiBAlE,8BAjDG,cjBoIsB,CiBzHvB,gCARG,iBACA,cACA,oBAAqB,CAKtB,uCAFG,WAAY,CACb,6BAKH,YAAa,CAkCd,uEbxDC,YACA,aAAc,CMKlB,mCNDI,UAAW,CMCf,sEOqBM,gBACA,eACA,kDACA,8CAA8B,oHAC9B,4CAAoC,oCACpC,gCAAyB,wBAC1B,mCAGC,UAAW,CAMZ,yCAHG,cACA,mCAA2B,0DAC5B,mCAID,WAAY,CAMb,yCAHG,cACA,kCAA0B,wDAC3B,yCAID,YAAa,CACd,mCPjDL,0COyDQ,YAAa,CACd,yCAGC,cAAe,CAChB,sBClEL,cACA,eACA,eACA,WACA,sBACA,kBACA,cAAc,CACf,oCRgBC,MACE,eAAgB,CAGlB,iBACE,SAAU,CACX,CAGH,oCACE,MACE,gBAAqB,CACtB,CSpCH,YACE,YnB+PuB,CmBjOxB,qCfhCG,YACA,aAAc,CAGhB,kBACE,UAAW,CeJf,oCAMI,gBACA,eACA,kDACA,8CAA8B,oHAC9B,4CAAoC,oCACpC,gCAAyB,wBAC1B,kBAGC,UAAW,CAMZ,wBAHG,cACA,mCAA2B,0DAC5B,kBAID,WAAY,CAMb,wBAHG,cACA,kCAA0B,wDC5BhC,QACE,cpBuQqB,CoBnQtB,sBCJC,iBAAkB,CAanB,gCAVG,crB0QwB,CqBjQzB,0CANG,gBrBoQwB,CqBnQzB,sCAGC,arBJc,CqBKf,mBCXH,cACA,cACA,kBACA,iDtBoDiE,CsBtClE,6DAVG,atBDgB,CsBEjB,mCAGC,aAAc,CAKf,0CAFG,cAAe,CCfrB,SAGE,iBACA,sBACA,mBAAwB,CAoFzB,wBAjFG,iDvBgD+D,CuB7BhE,6DAfG,aAAc,CACf,sCAGC,SACA,qBACA,gBACA,eACA,gBAA0C,CAC3C,8CAGC,aACA,avBQa,CuBPd,2BAID,iDvB0B+D,CuBlBhE,yCALG,eACA,gBACA,eACA,gBAA8C,CAC/C,uBAID,sBACA,gCACA,eAAgB,CA+BjB,0CA5BG,kBACA,avBda,CuBed,8DAKG,avB9CY,CuB+Cb,oCAID,eAAgB,CACjB,6BAIC,wDACA,yFvBkPwC,CuBzOzC,gDANG,aAA8B,CAC/B,oEAGC,aAAgC,CACjC,oCAMD,eACA,YACA,cACA,gBACA,iDvB1B6D,CuB+B9D,0CAFG,+BvB9EY,CuB+Eb,mCAML,SACE,iBACA,kBACA,WAAY,CAmBb,sCAhBG,cAAwC,CACzC,yCAGC,cACA,cAA4C,CAC7C,uBAGC,gBvB0LgC,CuBpLjC,0CAHG,eACA,aAAc,CACf,CChHP,WACE,iBACA,kBACA,iDxBqDiE,CwBflE,4BAnCG,qBACA,eACA,cACA,+BxBFgB,CwBGjB,2BAGC,aAAc,CA2Bf,6BAxBG,qBACA,kBACA,gBACA,qBACA,gCAAyB,wBACzB,8CAA8B,oHAC9B,4CAAoC,oCAiBrC,wCAdG,qBACA,kBACA,SACA,WACA,cACA,cxB6SuB,CwB5SxB,0GAKC,cACA,6BAAqB,8CCxC7B,YACE,iBACA,kBACA,iDzBwDiE,CyBlBlE,8BAnCG,qBACA,eACA,cACA,+BzBCgB,CyBAjB,6BAGC,aAAc,CA2Bf,4CAxBG,qBACA,kBACA,gBACA,qBACA,gCAAyB,wBACzB,8CAA8B,oHAC9B,4CAAoC,oCAiBrC,4DAdG,qBACA,kBACA,SACA,WACA,cACA,czBgTuB,CyB/SxB,uJAKC,cACA,6BAAqB,8CClC7B,eACE,eACA,MACA,OACA,SACA,YACA,iBACA,kBACA,iCACA,UACA,YAAa,CAGf,gBACE,kBACA,UACA,yBACA,eAAgB,CAGlB,kEAGE,eAAgB,CAGlB,8BACE,aAAc,CC3BhB,eACE,aACA,eACA,MACA,OACA,WACA,YACA,mBACA,kEACA,kBACA,8CAAgC,6HAChC,UAAW,CA6BZ,0BA1BG,yCAAuC,iCACxC,mCAGC,qBACA,iBAAkB,CAOnB,yCAJG,eACA,iBACA,4B3BqEkD,C2BpEnD,mCAID,cACA,YACA,WACA,eACA,kBACA,WACA,kBACA,kCAA2B,0BAG5B,8BlBPC,GACE,+CAAuC,uCAIzC,GACE,8CAAsC,6DANxC,GACE,+CAAuC,uCAIzC,GACE,8CAAsC,uCAI1C,4BACE,GACE,SAAU,CAGZ,GACE,SAAU,sBALZ,GACE,SAAU,CAGZ,GACE,SAAU,EAId,6BACE,GACE,gDAAwC,wCAG1C,GACE,+CAAuC,6DALzC,GACE,gDAAwC,wCAG1C,GACE,+CAAuC,wCAI3C,4BACE,GACE,+CAAuC,uCAGzC,GACE,gDAAwC,6DAL1C,GACE,+CAAuC,uCAGzC,GACE,gDAAwC,yCAI5C,0BACE,GACE,SAAU,CAGZ,GACE,SAAU,oBALZ,GACE,SAAU,CAGZ,GACE,SAAU,EAId,2BACE,GACE,8CAAsC,sCAGxC,GACE,+CAAuC,2DALzC,GACE,8CAAsC,sCAGxC,GACE,+CAAuC,wCAI3C,wCACE,kBAEA,UACA,SACA,6BACA,2BACA,WACA,WACA,wBT9FgB,CSuGjB,oDANG,+CAAuC,kFACxC,qDAGC,gDAAwC,oFAK1C,+DACE,+BAAwB,uBACxB,iCAAyB,yBACzB,kCAA0B,0BAG5B,gEACE,+BAAwB,uBACxB,iCAAyB,yBACzB,gCAAwB,wBAG1B,gEACE,+BAAwB,uBACxB,iCAAyB,yBACzB,iCAAyB,yBAK3B,6DACE,+BAAwB,uBACxB,iCAAyB,yBACzB,gCAAwB,wBAG1B,8DACE,+BAAwB,uBACxB,iCAAyB,yBACzB,8BAAsB,sBAGxB,8DACE,+BAAwB,uBACxB,iCAAyB,yBACzB,+BAAuB,uBkB1G7B,aACE,oC3BpC0B,C2B2D3B,+BApBG,kBACA,gBACA,gBACA,UACA,4B3B3CwB,C2B0DzB,iDAZG,kBACA,+B3B/CsB,C2BgDvB,iCAGC,eACA,iD3BH6D,C2BQ9D,uCAFG,a3BvDY,C2BwDb,mCAML,eACE,aAAc,CACf,CCvEH,aACE,aACA,eACA,WACA,YACA,8CAA8B,oHAC9B,4CAAoC,oCACpC,gCAAyB,wBACzB,UAAW,CAKZ,mBAFG,mCAA2B,0DAC5B,mCAID,aACE,sBAAwB,CACzB,CClBH,WACE,iBAAkB,CAmBnB,wBAhBG,cACA,cAAe,CAChB,uBAGC,cACA,iBAAkB,CACnB,uBAGC,eAAgB,CAKjB,yBAFG,a7BVc,C6BWf","file":"jane.min.css","sourcesContent":["// ==============================\n// Variables\n// ==============================\n\n// ========== Theme Color ========== //\n// Config here to change theme color\n// Default | Mint Green | Cobalt Blue | Hot Pink | Dark Violet\n$theme-color-config: 'Default';\n\n// Default theme color map\n$theme-color-map: (\n 'Default': #c05b4d #f8f5ec,\n 'Mint Green': #16982B #f5f5f5,\n 'Cobalt Blue': #0047AB #f0f2f5,\n 'Hot Pink': #FF69B4 #f8f5f5,\n 'Dark Violet': #9932CC #f5f4fa\n);\n\n// Check theme color config.\n// if it does not exist, use default theme color.\n@if not(map-has-key($theme-color-map, $theme-color-config)) {\n $theme-color-config: 'Default';\n}\n$theme-color-list: map-get($theme-color-map, $theme-color-config);\n\n// Default theme color of the site.\n$theme-color: nth($theme-color-list, 1) !default;\n\n// Deputy theme color of the site.\n$deputy-color: nth($theme-color-list, 2) !default;\n\n\n// ========== Color ========== //\n$black: #0a0a0a !default;\n$white: #fefefe !default;\n$light-gray: #e6e6e6 !default;\n$gray: #cacaca !default;\n$dark-gray: #8a8a8a !default;\n\n\n// ========== Global ========== //\n// Text color of the body.\n$global-font-color: #34495e !default;\n\n// Font size attribute applied to '<html>' and '<body>'.\n$global-font-size: 18px !default;\n\n// Global width of '<body>'.\n$global-body-width: 60em !default;\n\n// Padding of container main\n$global-container-padding: 0 20px !default;\n\n// Default line height for all type. `$global-lineheight` is 24px while `$global-font-size` is 16px.\n$global-lineheight: 1.8 !default;\n\n// Font family of the site.\n$global-font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif !default;\n\n// Serif font family of the site.\n$global-serif-font-family: Athelas, STHeiti, Microsoft Yahei, serif !default;\n\n// Background color of the site.\n$global-background: $white !default;\n\n// Headings font size of the site.\n$global-headings: (\n h1: 1.6em,\n h2: 1.5em,\n h3: 1.3em,\n h4: 1.2em,\n h5: 1.1em,\n h6: 1em\n) !default;\n\n\n// ========== Header ========== //\n// Padding of the site header.\n// $header-padding: 20px 20px !default;\n\n// Font family: Chancery\n@font-face {\n font-family: 'Chancery';\n src: url('../fonts/chancery/apple-chancery-webfont.eot');\n src: local('Apple Chancery'), url('../fonts/chancery/apple-chancery-webfont.eot?#iefix') format('embedded-opentype'),\n url('../fonts/chancery/apple-chancery-webfont.woff2') format('woff2'),\n url('../fonts/chancery/apple-chancery-webfont.woff') format('woff'),\n url('../fonts/chancery/apple-chancery-webfont.ttf') format('truetype'),\n url('../fonts/chancery/apple-chancery-webfont.svg#apple-chancery') format('svg');\n font-weight: lighter;\n font-style: normal;\n}\n\n// Font size of the logo.\n$logo-font-size: 36px !default;\n\n// Font family of the logo.\n$logo-font-family: 'Chancery', cursive, LiSu, sans-serif !default;\n\n// Margin of menu item.\n$menu-item-margin-left: 10px !default;\n\n// Margin of menu item in mobile.\n$menu-item-mobile-margin: 5px !default;\n\n// Font size of menu item link.\n$menu-link-font-size: 18px !default;\n\n// Height of the mobile header.\n$mobile-navbar-height: 50px !default;\n\n// ========== Post ========== //\n// Margin bottom of post list.\n$post-list-margin-bottom: 20px !default;\n\n// Padding of the post.\n$post-padding: 1.5em 0 !default;\n\n// Border top of the post + post.\n$post-border: 1px solid $light-gray !default;\n\n// Font size of post title.\n$post-title-font-size: 1.8em !default;\n\n// Font weight of post title.\n$post-title-font-weight: 400 !default;\n\n// Margin top of the post meta (post time).\n$post-meta-margin-top: 5px !default;\n\n// Font color of the post meta.\n$post-meta-font-color: $dark-gray !default;\n\n// Border bottom of the read more link when hover it.\n$post-readMore-border-bottom: 1px solid $theme-color !default;\n\n// Margin top of the post footer.\n$post-footer-margin-top: 20px !default;\n\n// Border top of post footer.\n$post-footer-border-top: 1px solid $light-gray !default;\n\n// Padding of the post tags.\n$post-tags-padding: 15px 0 !default;\n\n// Font size of post pagination.\n$post-nav-font-size: 18px !default;\n\n\n// ========== TOC ========== //\n// Width of the post toc.\n$post-toc-width: 200px !default;\n\n// Backgroud color of the post toc.\n$post-toc-backgroud: rgba($deputy-color, 0.6) !default;\n\n// Margin left of the post toc.\n//$post-toc-margin-left: $global-body-width - 15px !default;\n\n// Font size of the post toc title.\n$post-toc-title-size: 20px !default;\n\n// Font size of the post toc content.\n$post-toc-content: 15px !default;\n\n// List style of the post toc list.\n$post-toc-list-style: square !default;\n\n// Max screen media of the post toc.\n// $toc-max-sreen-width: 2 * $post-toc-width + $post-toc-margin-left !default;\n\n// ========== Content ========== //\n// Headings anchor.\n$content-headings-anchor: \"\" !default;\n\n// Border bottom of the link when hover it.\n$content-link-border: 1px solid $theme-color !default;\n\n// Background color of the blockquote.\n$content-blockquote-backgroud: rgba($theme-color, 0.05) !default;\n\n// Border left of the blockquote.\n$content-blockquote-border-left: 3px solid rgba($theme-color, 0.3) !default;\n\n// Border color of the table.\n$content-table-border-color: darken($deputy-color, 3%) !default;\n\n// ========== Code ========== //\n// Color of the code.\n$code-color: #c7254e !default;\n\n// Font size of code.\n$code-font-size: 13px !default;\n\n// Font family of the code.\n$code-font-family: Consolas, Monaco, Menlo, Consolas, monospace !default;\n\n// Color of code highlight, solarized.\n$code-highlight-color: (\n comment: #93a1a1,\n keyword: #859900,\n number: #2aa198,\n title: #268bd2,\n attribute: #b58900,\n symbol: #cb4b16,\n built_in: #dc322f,\n formula: #eee8d5\n) !default;\n\n// Code type list.\n$code-type-list: (\n // Custom code type\n language-bash: \"Bash\",\n language-c: \"C\",\n language-cs: \"C#\",\n language-cpp: \"C++\",\n language-css: \"CSS\",\n language-coffeescript: \"CoffeeScript\",\n language-html: \"HTML\",\n language-xml: \"XML\",\n language-http: \"HTTP\",\n language-json: \"JSON\",\n language-java: \"Java\",\n language-js: \"JavaScript\",\n language-javascript: \"JavaScript\",\n language-makefile: \"Makefile\",\n language-markdown: \"Markdown\",\n language-objectivec: \"Objective-C\",\n language-php: \"PHP\",\n language-perl: \"Perl\",\n language-python: \"Python\",\n language-ruby: \"Ruby\",\n language-sql: \"SQL\",\n language-shell: \"Shell\",\n\n language-erlang: \"Erlang\",\n language-go: \"Go\",\n language-groovy: \"Groovy\",\n language-haskell: \"Haskell\",\n language-kotlin: \"Kotlin\",\n language-less: \"Less\",\n language-lisp: \"Lisp\",\n language-lua: \"Lua\",\n language-matlab: \"Matlab\",\n language-rust: \"Rust\",\n language-scss: \"Scss\",\n language-scala: \"Scala\",\n language-swift: \"Swift\",\n language-typescript: \"TypeScript\",\n language-yml: \"YAML\",\n language-yaml: \"YAML\",\n language-toml: \"TOML\"\n) !default;\n\n// Color of the code background.\n$code-background: $deputy-color !default;\n\n\n// ========== Pagination ========== //\n// Margin of the pagination.\n$pagination-margin: 2em 0 !default;\n\n// Font size of the pagination (Without post, post pagination see line 140).\n$pagination-font-size: 20px !default;\n\n\n// ========== Footer ========== //\n// Margin top of the footer.\n$footer-margin-top: 2em !default;\n\n// Margin left of the social link.\n$social-link-margin-left: 10px !default;\n\n// Font size of the social icon.\n$social-icon-font-size: 30px !default;\n\n// Margin of the copyright.\n$copyright-margin: 10px 0 !default;\n\n\n// ========== Archive ========== //\n// Margin of the archive.\n$archive-margin: 2em 0px !default;\n\n// Max width of the archive.\n$archive-max-width: 550px !default;\n\n// Font size of the archive name.\n$archive-name-font-size: 30px !default;\n\n// Font size of the collection title.\n$collection-title-font-size: 28px !default;\n\n// Padding of the archive post.\n$archive-post-padding: 15px 20px 5px 20px !default;\n\n// Padding of the archive post in mobile.\n$archive-post-mobile-padding: 5px 10px !default;\n\n// Font size of the archive post time in mobile.\n$archive-post-mobile-time-font-size: 13px !default;\n\n// Border left of the archive post, use $archive-post-hover-border-left when hover it.\n$archive-post-border: 1px solid $gray !default;\n$archive-post-hover-border-left: 3px solid $theme-color !default;\n\n// Transition of the archive post when hover it.\n$archive-post-hover-transition: 0.2s ease-out !default;\n\n// Transform of the archive post when hover it.\n$archive-post-hover-transform: translateX(4px) !default;\n\n\n// ========== Tags ========== //\n// Font soze of the tag cloud title.\n$tag-cloud-title-size: 24px !default;\n\n// Border bottom of the tag cloud title.\n$tag-cloud-title-border-bottom: 2px solid $theme-color !default;\n\n// Margin of the tag cloud tags link.\n$tag-cloud-tags-link-margin: 5px 10px !default;\n\n\n// ========== Categories ========== //\n// Font soze of the categories title.\n$categories-title-size: 18px !default;\n\n// Border bottom of the categories title.\n$categories-title-border-bottom: 2px solid $theme-color !default;\n\n// Margin of the categories tags link.\n$categories-tags-link-margin: 5px 10px !default;\n\n// Font size of the category count\n$category-count-font-size: 12px !default;\n\n\n\n// WEBPACK FOOTER //\n// ./css/_variables.scss","/*! normalize.css v3.0.2 | MIT License | git.io/normalize */\n\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n * user zoom.\n */\n\nhtml {\n font-family: sans-serif; /* 1 */\n -ms-text-size-adjust: 100%; /* 2 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Remove default margin.\n */\n\nbody {\n margin: 0;\n}\n\n/* HTML5 display definitions\n ========================================================================== */\n\n/**\n * Correct `block` display not defined for any HTML5 element in IE 8/9.\n * Correct `block` display not defined for `details` or `summary` in IE 10/11\n * and Firefox.\n * Correct `block` display not defined for `main` in IE 11.\n */\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n display: block;\n}\n\n/**\n * 1. Correct `inline-block` display not defined in IE 8/9.\n * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\n */\n\naudio,\ncanvas,\nprogress,\nvideo {\n display: inline-block; /* 1 */\n vertical-align: baseline; /* 2 */\n}\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\n/**\n * Address `[hidden]` styling not present in IE 8/9/10.\n * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.\n */\n\n[hidden],\ntemplate {\n display: none;\n}\n\n/* Links\n ========================================================================== */\n\n/**\n * Remove the gray background color from active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * Improve readability when focused and also mouse hovered in all browsers.\n */\n\na:active,\na:hover {\n outline: 0;\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Address styling not present in IE 8/9/10/11, Safari, and Chrome.\n */\n\nabbr[title] {\n border-bottom: 1px dotted;\n}\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * Address styling not present in Safari and Chrome.\n */\n\ndfn {\n font-style: italic;\n}\n\n/**\n * Address variable `h1` font-size and margin within `section` and `article`\n * contexts in Firefox 4+, Safari, and Chrome.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/**\n * Address styling not present in IE 8/9.\n */\n\nmark {\n background: #ff0;\n color: #000;\n}\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsup {\n top: -0.5em;\n}\n\nsub {\n bottom: -0.25em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove border when inside `a` element in IE 8/9/10.\n */\n\nimg {\n border: 0;\n}\n\n/**\n * Correct overflow not hidden in IE 9/10/11.\n */\n\nsvg:not(:root) {\n overflow: hidden;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * Address margin not present in IE 8/9 and Safari.\n */\n\nfigure {\n margin: 1em 40px;\n}\n\n/**\n * Address differences between Firefox and other browsers.\n */\n\nhr {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n height: 0;\n}\n\n/**\n * Contain overflow in all browsers.\n */\n\npre {\n overflow: auto;\n}\n\n/**\n * Address odd `em`-unit font size rendering in all browsers.\n */\n\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * Known limitation: by default, Chrome and Safari on OS X allow very limited\n * styling of `select`, unless a `border` property is set.\n */\n\n/**\n * 1. Correct color not being inherited.\n * Known issue: affects color of disabled elements.\n * 2. Correct font properties not being inherited.\n * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n color: inherit; /* 1 */\n font: inherit; /* 2 */\n margin: 0; /* 3 */\n}\n\n/**\n * Address `overflow` set to `hidden` in IE 8/9/10/11.\n */\n\nbutton {\n overflow: visible;\n}\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.\n * Correct `select` style inheritance in Firefox.\n */\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n * and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n * `input` and others.\n */\n\nbutton,\nhtml input[type=\"button\"], /* 1 */\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n -webkit-appearance: button; /* 2 */\n cursor: pointer; /* 3 */\n}\n\n/**\n * Re-set default cursor for disabled elements.\n */\n\nbutton[disabled],\nhtml input[disabled] {\n cursor: default;\n}\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n border: 0;\n padding: 0;\n}\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\n\ninput {\n line-height: normal;\n}\n\n/**\n * It's recommended that you don't attempt to style these elements.\n * Firefox's implementation doesn't respect box-sizing, padding, or width.\n *\n * 1. Address box sizing set to `content-box` in IE 8/9/10.\n * 2. Remove excess padding in IE 8/9/10.\n */\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Fix the cursor style for Chrome's increment/decrement buttons. For certain\n * `font-size` values of the `input`, it causes the cursor style of the\n * decrement button to change from `default` to `text`.\n */\n\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari and Chrome\n * (include `-moz` to future-proof).\n */\n\ninput[type=\"search\"] {\n -webkit-appearance: textfield; /* 1 */\n -moz-box-sizing: content-box;\n -webkit-box-sizing: content-box; /* 2 */\n box-sizing: content-box;\n}\n\n/**\n * Remove inner padding and search cancel button in Safari and Chrome on OS X.\n * Safari (but not Chrome) clips the cancel button when the search input has\n * padding (and `textfield` appearance).\n */\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * Define consistent border, margin, and padding.\n */\n\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9/10/11.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\n\nlegend {\n border: 0; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Remove default vertical scrollbar in IE 8/9/10/11.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * Don't inherit the `font-weight` (applied by a rule above).\n * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\n */\n\noptgroup {\n font-weight: bold;\n}\n\n/* Tables\n ========================================================================== */\n\n/**\n * Remove most spacing between table cells.\n */\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\ntd,\nth {\n padding: 0;\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_common/_normalize.scss","@charset \"UTF-8\";\n@font-face {\n font-family: 'Chancery';\n src: url(\"../fonts/chancery/apple-chancery-webfont.eot\");\n src: local(\"Apple Chancery\"), url(\"../fonts/chancery/apple-chancery-webfont.eot?#iefix\") format(\"embedded-opentype\"), url(\"../fonts/chancery/apple-chancery-webfont.woff2\") format(\"woff2\"), url(\"../fonts/chancery/apple-chancery-webfont.woff\") format(\"woff\"), url(\"../fonts/chancery/apple-chancery-webfont.ttf\") format(\"truetype\"), url(\"../fonts/chancery/apple-chancery-webfont.svg#apple-chancery\") format(\"svg\");\n font-weight: lighter;\n font-style: normal; }\n\n/*! normalize.css v3.0.2 | MIT License | git.io/normalize */\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n * user zoom.\n */\nhtml {\n font-family: sans-serif;\n /* 1 */\n -ms-text-size-adjust: 100%;\n /* 2 */\n -webkit-text-size-adjust: 100%;\n /* 2 */ }\n\n/**\n * Remove default margin.\n */\nbody {\n margin: 0; }\n\n/* HTML5 display definitions\n ========================================================================== */\n/**\n * Correct `block` display not defined for any HTML5 element in IE 8/9.\n * Correct `block` display not defined for `details` or `summary` in IE 10/11\n * and Firefox.\n * Correct `block` display not defined for `main` in IE 11.\n */\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n display: block; }\n\n/**\n * 1. Correct `inline-block` display not defined in IE 8/9.\n * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\n */\naudio,\ncanvas,\nprogress,\nvideo {\n display: inline-block;\n /* 1 */\n vertical-align: baseline;\n /* 2 */ }\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\naudio:not([controls]) {\n display: none;\n height: 0; }\n\n/**\n * Address `[hidden]` styling not present in IE 8/9/10.\n * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.\n */\n[hidden],\ntemplate {\n display: none; }\n\n/* Links\n ========================================================================== */\n/**\n * Remove the gray background color from active links in IE 10.\n */\na {\n background-color: transparent; }\n\n/**\n * Improve readability when focused and also mouse hovered in all browsers.\n */\na:active,\na:hover {\n outline: 0; }\n\n/* Text-level semantics\n ========================================================================== */\n/**\n * Address styling not present in IE 8/9/10/11, Safari, and Chrome.\n */\nabbr[title] {\n border-bottom: 1px dotted; }\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.\n */\nb,\nstrong {\n font-weight: bold; }\n\n/**\n * Address styling not present in Safari and Chrome.\n */\ndfn {\n font-style: italic; }\n\n/**\n * Address variable `h1` font-size and margin within `section` and `article`\n * contexts in Firefox 4+, Safari, and Chrome.\n */\nh1 {\n font-size: 2em;\n margin: 0.67em 0; }\n\n/**\n * Address styling not present in IE 8/9.\n */\nmark {\n background: #ff0;\n color: #000; }\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\nsmall {\n font-size: 80%; }\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline; }\n\nsup {\n top: -0.5em; }\n\nsub {\n bottom: -0.25em; }\n\n/* Embedded content\n ========================================================================== */\n/**\n * Remove border when inside `a` element in IE 8/9/10.\n */\nimg {\n border: 0; }\n\n/**\n * Correct overflow not hidden in IE 9/10/11.\n */\nsvg:not(:root) {\n overflow: hidden; }\n\n/* Grouping content\n ========================================================================== */\n/**\n * Address margin not present in IE 8/9 and Safari.\n */\nfigure {\n margin: 1em 40px; }\n\n/**\n * Address differences between Firefox and other browsers.\n */\nhr {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n height: 0; }\n\n/**\n * Contain overflow in all browsers.\n */\npre {\n overflow: auto; }\n\n/**\n * Address odd `em`-unit font size rendering in all browsers.\n */\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em; }\n\n/* Forms\n ========================================================================== */\n/**\n * Known limitation: by default, Chrome and Safari on OS X allow very limited\n * styling of `select`, unless a `border` property is set.\n */\n/**\n * 1. Correct color not being inherited.\n * Known issue: affects color of disabled elements.\n * 2. Correct font properties not being inherited.\n * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.\n */\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n color: inherit;\n /* 1 */\n font: inherit;\n /* 2 */\n margin: 0;\n /* 3 */ }\n\n/**\n * Address `overflow` set to `hidden` in IE 8/9/10/11.\n */\nbutton {\n overflow: visible; }\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.\n * Correct `select` style inheritance in Firefox.\n */\nbutton,\nselect {\n text-transform: none; }\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n * and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n * `input` and others.\n */\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n -webkit-appearance: button;\n /* 2 */\n cursor: pointer;\n /* 3 */ }\n\n/**\n * Re-set default cursor for disabled elements.\n */\nbutton[disabled],\nhtml input[disabled] {\n cursor: default; }\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n border: 0;\n padding: 0; }\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\ninput {\n line-height: normal; }\n\n/**\n * It's recommended that you don't attempt to style these elements.\n * Firefox's implementation doesn't respect box-sizing, padding, or width.\n *\n * 1. Address box sizing set to `content-box` in IE 8/9/10.\n * 2. Remove excess padding in IE 8/9/10.\n */\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n box-sizing: border-box;\n /* 1 */\n padding: 0;\n /* 2 */ }\n\n/**\n * Fix the cursor style for Chrome's increment/decrement buttons. For certain\n * `font-size` values of the `input`, it causes the cursor style of the\n * decrement button to change from `default` to `text`.\n */\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n height: auto; }\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari and Chrome\n * (include `-moz` to future-proof).\n */\ninput[type=\"search\"] {\n -webkit-appearance: textfield;\n /* 1 */\n -moz-box-sizing: content-box;\n -webkit-box-sizing: content-box;\n /* 2 */\n box-sizing: content-box; }\n\n/**\n * Remove inner padding and search cancel button in Safari and Chrome on OS X.\n * Safari (but not Chrome) clips the cancel button when the search input has\n * padding (and `textfield` appearance).\n */\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none; }\n\n/**\n * Define consistent border, margin, and padding.\n */\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em; }\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9/10/11.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\nlegend {\n border: 0;\n /* 1 */\n padding: 0;\n /* 2 */ }\n\n/**\n * Remove default vertical scrollbar in IE 8/9/10/11.\n */\ntextarea {\n overflow: auto; }\n\n/**\n * Don't inherit the `font-weight` (applied by a rule above).\n * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\n */\noptgroup {\n font-weight: bold; }\n\n/* Tables\n ========================================================================== */\n/**\n * Remove most spacing between table cells.\n */\ntable {\n border-collapse: collapse;\n border-spacing: 0; }\n\ntd,\nth {\n padding: 0; }\n\nhtml {\n font-size: 18px;\n box-sizing: border-box; }\n\nbody {\n padding: 0;\n margin: 0;\n font-family: \"Source Sans Pro\", \"Helvetica Neue\", Arial, sans-serif;\n font-weight: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1.8;\n color: #34495e;\n background: #fefefe;\n scroll-behavior: smooth; }\n\n@media screen and (max-width: 60em) {\n body {\n border-top: 0; } }\n\n::selection {\n background: #c05b4d;\n color: #fff; }\n\nimg {\n max-width: 100%;\n height: auto;\n display: inline-block;\n vertical-align: middle; }\n\na {\n color: #34495e;\n text-decoration: none; }\n\nh1 {\n font-size: 1.6em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh2 {\n font-size: 1.5em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh3 {\n font-size: 1.3em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh4 {\n font-size: 1.2em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh5 {\n font-size: 1.1em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh6 {\n font-size: 1em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\n.container {\n margin: 0 auto;\n width: 60em; }\n\n@media screen and (max-width: 60em) {\n .container {\n width: 100%;\n box-shadow: -1px -5px 5px #cacaca; } }\n\n.content-wrapper {\n padding: 3em 0 1px 0; }\n\n.video-container {\n position: relative;\n padding-bottom: 56.25%;\n /* 16:9 */\n padding-top: 25px;\n height: 0; }\n\n.video-container iframe {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%; }\n\n.bg-llight {\n background-color: #f2f2f5; }\n\n.bg-white {\n background-color: #FFF; }\n\n@font-face {\n font-family: 'iconfont';\n /* project id 96542 */\n src: url(\"../fonts/iconfont/iconfont.eot\");\n src: url(\"../fonts/iconfont/iconfont.eot#iefix\") format(\"embedded-opentype\"), url(\"../fonts/iconfont/iconfont.woff\") format(\"woff\"), url(\"../fonts/iconfont/iconfont.ttf\") format(\"truetype\"), url(\"../fonts/iconfont/iconfont.svg#iconfont\") format(\"svg\"); }\n\n.iconfont {\n font-family: \"iconfont\" !important;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -webkit-text-stroke-width: 0.2px;\n -moz-osx-font-smoothing: grayscale;\n cursor: pointer; }\n\n.icon-instagram:before {\n font-size: .95em;\n content: \"\\e611\";\n position: relative;\n top: -1px; }\n\n.icon-douban:before {\n content: \"\\e610\"; }\n\n.icon-tumblr:before {\n content: \"\\e69f\";\n font-size: .85em;\n position: relative;\n top: -4px; }\n\n.icon-linkedin:before {\n content: \"\\e60d\";\n position: relative;\n top: -4px; }\n\n.icon-twitter:before {\n content: \"\\e600\"; }\n\n.icon-weibo:before {\n content: \"\\e602\"; }\n\n.icon-stack-overflow:before {\n content: \"\\e603\";\n font-size: .85em;\n position: relative;\n top: -4px; }\n\n.icon-email:before {\n content: \"\\e605\";\n position: relative;\n top: -2px; }\n\n.icon-facebook:before {\n content: \"\\e601\";\n font-size: .95em;\n position: relative;\n top: -2px; }\n\n.icon-github:before {\n content: \"\\e606\";\n position: relative;\n top: -3px; }\n\n.icon-rss:before {\n content: \"\\e604\"; }\n\n.icon-google:before {\n content: \"\\e609\"; }\n\n.icon-zhihu:before {\n content: \"\\e607\";\n font-size: .9em;\n position: relative;\n top: -2px; }\n\n.icon-pocket:before {\n content: \"\\e856\"; }\n\n/* Generic Icon */\n.icon-heart:before {\n content: \"\\e608\"; }\n\n.icon-right:before {\n content: \"\\e60a\"; }\n\n.icon-left:before {\n content: \"\\e60b\"; }\n\n.icon-up:before {\n content: \"\\e60c\"; }\n\n.icon-close:before {\n content: \"\\e60f\"; }\n\n.header:before, .header:after {\n content: \" \";\n display: table; }\n\n.header:after {\n clear: both; }\n\n.header .logo-wrapper {\n float: left; }\n .header .logo-wrapper .logo {\n font-size: 36px;\n font-family: \"Chancery\", cursive, LiSu, sans-serif; }\n\n@media screen and (max-width: 60em) {\n .header .logo-wrapper {\n display: none; } }\n\n.header .site-navbar .menu {\n float: right;\n padding-left: 0;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .header .site-navbar .menu .menu-item {\n display: inline-block;\n margin-left: 1em;\n margin-right: 1em;\n display: inline-block;\n vertical-align: middle;\n transform: translateZ(0);\n backface-visibility: hidden;\n box-shadow: 0 0 1px transparent;\n position: relative;\n overflow: hidden; }\n .header .site-navbar .menu .menu-item + .menu-item {\n margin-left: 10px; }\n .header .site-navbar .menu .menu-item:before {\n content: '';\n position: absolute;\n z-index: -1;\n height: 2px;\n bottom: 0;\n left: 51%;\n right: 51%;\n background: #c05b4d;\n transition-duration: 0.2s;\n transition-property: right, left;\n transition-timing-function: ease-out; }\n .header .site-navbar .menu .menu-item.active:before, .header .site-navbar .menu .menu-item:active:before, .header .site-navbar .menu .menu-item:focus:before, .header .site-navbar .menu .menu-item:hover:before {\n right: 0;\n left: 0; }\n .header .site-navbar .menu .menu-item-link {\n font-size: 18px; }\n\n@media screen and (max-width: 60em) {\n .header .site-navbar {\n display: none; } }\n\n@media screen and (max-width: 60em) {\n .header {\n padding: 50px 0 0;\n text-align: center; } }\n\n.post {\n padding: 3em 5em;\n margin-bottom: 3em; }\n .post .post-header {\n margin-bottom: 20px;\n text-align: center;\n padding-bottom: 10px;\n border-bottom: 2px LightGrey solid; }\n .post .post-header .post-title {\n margin: 0;\n font-size: 1.8em;\n font-weight: 400;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-header .post-link {\n display: inline-block;\n vertical-align: middle;\n transform: translateZ(0);\n backface-visibility: hidden;\n box-shadow: 0 0 1px transparent;\n position: relative;\n overflow: hidden; }\n .post .post-header .post-link:before {\n content: '';\n position: absolute;\n z-index: -1;\n height: 2px;\n bottom: 0;\n left: 51%;\n right: 51%;\n background: #c05b4d;\n transition-duration: 0.2s;\n transition-property: right, left;\n transition-timing-function: ease-out; }\n .post .post-header .post-link.active:before, .post .post-header .post-link:active:before, .post .post-header .post-link:focus:before, .post .post-header .post-link:hover:before {\n right: 0;\n left: 0; }\n .post .post-header .post-meta {\n font-size: 14px;\n color: #8a8a8a; }\n .post .post-header .post-meta .post-time {\n font-size: 15px; }\n .post .post-header .post-meta .post-category {\n display: inline; }\n .post .post-header .post-meta .post-category a {\n color: inherit; }\n .post .post-header .post-meta .post-category a::before {\n content: '·'; }\n .post .post-header .post-meta .post-category a:hover {\n color: #c05b4d; }\n .post .post-header .post-meta .more-meta::before {\n content: '·'; }\n .post .post-toc {\n padding: 10px;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif;\n border-bottom: 2px LightGrey solid;\n word-wrap: break-word; }\n .post .post-toc .post-toc-title {\n margin: 0 10px;\n font-size: 20px;\n font-weight: 400;\n text-transform: uppercase; }\n .post .post-toc .post-toc-content {\n font-size: 15px; }\n .post .post-toc .post-toc-content.always-active ul {\n display: block; }\n .post .post-toc .post-toc-content > nav > ul {\n margin: 10px 0; }\n .post .post-toc .post-toc-content ul {\n padding-left: 20px;\n list-style: square; }\n .post .post-toc .post-toc-content ul li > a {\n color: #139; }\n .post .post-toc .post-toc-content ul li > a:hover {\n color: #900; }\n .post .post-toc .post-toc-content ul ul {\n list-style: circle; }\n .post .post-toc .post-toc-content .toc-link.active {\n color: #c05b4d; }\n .post .post-content {\n word-wrap: break-word; }\n .post .post-content h1 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h2 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h3 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h4 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h5 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h6 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h1 {\n border-bottom: 1px solid #ddd;\n margin-top: 2em; }\n .post .post-content h2 {\n border-bottom: 1px solid #ddd;\n margin-top: 2em; }\n .post .post-content h3 {\n margin-top: 1.5em; }\n .post .post-content a {\n color: #c05b4d;\n word-break: break-all; }\n .post .post-content a:hover {\n border-bottom: 1px solid #c05b4d; }\n .post .post-content a.fancybox {\n border: 0; }\n .post .post-content blockquote {\n margin: 1em 0;\n padding: 1px 20px;\n position: relative;\n color: rgba(52, 73, 94, 0.8);\n background-color: rgba(192, 91, 77, 0.05);\n border-left: 3px solid rgba(192, 91, 77, 0.3);\n box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.125); }\n .post .post-content blockquote p {\n margin: 0.5em 0; }\n .post .post-content blockquote footer {\n margin: 0.5em 0; }\n .post .post-content blockquote cite:before {\n content: '\\2014';\n padding-right: .3em;\n padding-left: .3em;\n color: #aaa; }\n .post .post-content img {\n display: inline-block;\n max-width: 100%; }\n .post .post-content > table {\n max-width: 100%;\n margin: 10px 0;\n border-spacing: 0;\n box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.125); }\n .post .post-content > table thead {\n background: #f8f5ec; }\n .post .post-content > table th, .post .post-content > table td {\n padding: 5px 15px;\n border: 1px double #f4efe1; }\n .post .post-content > table tr:hover {\n background-color: #f8f5ec; }\n .post .post-content code, .post .post-content pre {\n padding: 7px;\n font-size: 13px;\n font-family: Consolas, Monaco, Menlo, Consolas, monospace;\n background: #f8f5ec; }\n .post .post-content code {\n padding: 3px 5px;\n border-radius: 4px;\n color: #c7254e; }\n .post .post-content .highlight {\n margin: 1em 0;\n border-radius: 5px;\n overflow-x: auto;\n box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.125);\n position: relative; }\n .post .post-content .highlight table {\n position: relative; }\n .post .post-content .highlight table::after {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n padding: 2px 7px;\n font-size: 13px;\n font-weight: bold;\n color: #b1b1b1;\n background: #f4efe1;\n content: 'Code'; }\n .post .post-content .highlight.language-bash > table::after {\n content: \"Bash\"; }\n .post .post-content .highlight.language-c > table::after {\n content: \"C\"; }\n .post .post-content .highlight.language-cs > table::after {\n content: \"C#\"; }\n .post .post-content .highlight.language-cpp > table::after {\n content: \"C++\"; }\n .post .post-content .highlight.language-css > table::after {\n content: \"CSS\"; }\n .post .post-content .highlight.language-coffeescript > table::after {\n content: \"CoffeeScript\"; }\n .post .post-content .highlight.language-html > table::after {\n content: \"HTML\"; }\n .post .post-content .highlight.language-xml > table::after {\n content: \"XML\"; }\n .post .post-content .highlight.language-http > table::after {\n content: \"HTTP\"; }\n .post .post-content .highlight.language-json > table::after {\n content: \"JSON\"; }\n .post .post-content .highlight.language-java > table::after {\n content: \"Java\"; }\n .post .post-content .highlight.language-js > table::after {\n content: \"JavaScript\"; }\n .post .post-content .highlight.language-javascript > table::after {\n content: \"JavaScript\"; }\n .post .post-content .highlight.language-makefile > table::after {\n content: \"Makefile\"; }\n .post .post-content .highlight.language-markdown > table::after {\n content: \"Markdown\"; }\n .post .post-content .highlight.language-objectivec > table::after {\n content: \"Objective-C\"; }\n .post .post-content .highlight.language-php > table::after {\n content: \"PHP\"; }\n .post .post-content .highlight.language-perl > table::after {\n content: \"Perl\"; }\n .post .post-content .highlight.language-python > table::after {\n content: \"Python\"; }\n .post .post-content .highlight.language-ruby > table::after {\n content: \"Ruby\"; }\n .post .post-content .highlight.language-sql > table::after {\n content: \"SQL\"; }\n .post .post-content .highlight.language-shell > table::after {\n content: \"Shell\"; }\n .post .post-content .highlight.language-erlang > table::after {\n content: \"Erlang\"; }\n .post .post-content .highlight.language-go > table::after {\n content: \"Go\"; }\n .post .post-content .highlight.language-groovy > table::after {\n content: \"Groovy\"; }\n .post .post-content .highlight.language-haskell > table::after {\n content: \"Haskell\"; }\n .post .post-content .highlight.language-kotlin > table::after {\n content: \"Kotlin\"; }\n .post .post-content .highlight.language-less > table::after {\n content: \"Less\"; }\n .post .post-content .highlight.language-lisp > table::after {\n content: \"Lisp\"; }\n .post .post-content .highlight.language-lua > table::after {\n content: \"Lua\"; }\n .post .post-content .highlight.language-matlab > table::after {\n content: \"Matlab\"; }\n .post .post-content .highlight.language-rust > table::after {\n content: \"Rust\"; }\n .post .post-content .highlight.language-scss > table::after {\n content: \"Scss\"; }\n .post .post-content .highlight.language-scala > table::after {\n content: \"Scala\"; }\n .post .post-content .highlight.language-swift > table::after {\n content: \"Swift\"; }\n .post .post-content .highlight.language-typescript > table::after {\n content: \"TypeScript\"; }\n .post .post-content .highlight.language-yml > table::after {\n content: \"YAML\"; }\n .post .post-content .highlight.language-yaml > table::after {\n content: \"YAML\"; }\n .post .post-content .highlight.language-toml > table::after {\n content: \"TOML\"; }\n .post .post-content .highlight .code pre {\n margin: 0;\n padding: 30px 10px 10px; }\n .post .post-content .highlight .gutter {\n width: 10px;\n color: #cacaca; }\n .post .post-content .highlight .gutter pre {\n margin: 0;\n padding: 30px 7px 10px; }\n .post .post-content .highlight .line {\n height: 20px; }\n .post .post-content .highlight table, .post .post-content .highlight tr, .post .post-content .highlight td {\n margin: 0;\n padding: 0;\n width: 100%;\n border-collapse: collapse; }\n .post .post-content .highlight .code .hljs-comment,\n .post .post-content .highlight .code .hljs-quote {\n color: #93a1a1; }\n .post .post-content .highlight .code .hljs-keyword,\n .post .post-content .highlight .code .hljs-selector-tag,\n .post .post-content .highlight .code .hljs-addition {\n color: #859900; }\n .post .post-content .highlight .code .hljs-number,\n .post .post-content .highlight .code .hljs-string,\n .post .post-content .highlight .code .hljs-meta .hljs-meta-string,\n .post .post-content .highlight .code .hljs-literal,\n .post .post-content .highlight .code .hljs-doctag,\n .post .post-content .highlight .code .hljs-regexp {\n color: #2aa198; }\n .post .post-content .highlight .code .hljs-title,\n .post .post-content .highlight .code .hljs-section,\n .post .post-content .highlight .code .hljs-name,\n .post .post-content .highlight .code .hljs-selector-id,\n .post .post-content .highlight .code .hljs-selector-class {\n color: #268bd2; }\n .post .post-content .highlight .code .hljs-attribute,\n .post .post-content .highlight .code .hljs-attr,\n .post .post-content .highlight .code .hljs-variable,\n .post .post-content .highlight .code .hljs-template-variable,\n .post .post-content .highlight .code .hljs-class .hljs-title,\n .post .post-content .highlight .code .hljs-type {\n color: #b58900; }\n .post .post-content .highlight .code .hljs-symbol,\n .post .post-content .highlight .code .hljs-bullet,\n .post .post-content .highlight .code .hljs-subst,\n .post .post-content .highlight .code .hljs-meta,\n .post .post-content .highlight .code .hljs-meta .hljs-keyword,\n .post .post-content .highlight .code .hljs-selector-attr,\n .post .post-content .highlight .code .hljs-selector-pseudo,\n .post .post-content .highlight .code .hljs-link {\n color: #cb4b16; }\n .post .post-content .highlight .code .hljs-built_in,\n .post .post-content .highlight .code .hljs-deletion {\n color: #dc322f; }\n .post .post-content .highlight .code .hljs-formula {\n background: #eee8d5; }\n .post .post-content .highlight .code .hljs-emphasis {\n font-style: italic; }\n .post .post-content .highlight .code .hljs-strong {\n font-weight: bold; }\n .post .post-content .post-summary {\n margin-bottom: 1em; }\n .post .post-content .read-more .read-more-link {\n float: right;\n color: #c05b4d;\n font-size: 1.1em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content .read-more .read-more-link:hover {\n border-bottom: 1px solid #c05b4d; }\n .post .post-content kbd {\n display: inline-block;\n padding: 0.25em;\n background-color: #fafafa;\n border: 1px solid #dbdbdb;\n border-bottom-color: #b5b5b5;\n border-radius: 3px;\n box-shadow: inset 0 -1px 0 #b5b5b5;\n font-size: 0.8em;\n line-height: 1.25;\n font-family: \"SFMono-Regular\",\"Liberation Mono\",\"Roboto Mono\",Menlo,Monaco,Consolas,\"Courier New\",Courier,monospace;\n color: #4a4a4a; }\n .post .post-content dl dt::after {\n content: ':'; }\n .post .post-content figure.center {\n text-align: center; }\n .post .post-content figure figcaption h4 {\n color: #b5b5b5;\n font-size: 0.9rem; }\n .post .post-content .task-list {\n list-style: none;\n padding-left: 1.5rem; }\n .post .post-copyright {\n margin-top: 20px;\n padding-top: 10px;\n border-top: 1px dashed #e6e6e6; }\n .post .post-copyright .copyright-item {\n margin: 5px 0; }\n .post .post-copyright .copyright-item a {\n color: #c05b4d;\n word-wrap: break-word; }\n .post .post-copyright .copyright-item a:hover {\n border-bottom: 1px solid #c05b4d; }\n .post .post-copyright .copyright-item .item-title {\n display: inline-block;\n min-width: 5rem;\n margin-right: .5rem;\n text-align: right; }\n .post .post-copyright .copyright-item .item-title:after {\n content: \" :\"; }\n .post .post-reward {\n margin-top: 20px;\n padding-top: 10px;\n text-align: center;\n border-top: 1px dashed #e6e6e6; }\n .post .post-reward .reward-button {\n margin: 15px 0;\n padding: 3px 7px;\n display: inline-block;\n color: #c05b4d;\n border: 1px solid #c05b4d;\n border-radius: 5px;\n cursor: pointer; }\n .post .post-reward .reward-button:hover {\n color: #fefefe;\n background-color: #c05b4d;\n transition: 0.5s; }\n .post .post-reward #reward:checked ~ .qr-code {\n display: block; }\n .post .post-reward #reward:checked ~ .reward-button {\n display: none; }\n .post .post-reward .qr-code {\n display: none; }\n .post .post-reward .qr-code .qr-code-image {\n display: inline-block;\n min-width: 200px;\n width: 40%;\n margin-top: 15px; }\n .post .post-reward .qr-code .qr-code-image span {\n display: inline-block;\n width: 100%;\n margin: 8px 0; }\n .post .post-reward .qr-code .image {\n width: 200px;\n height: 200px; }\n .post .post-footer {\n margin-top: 20px;\n margin-bottom: 40px;\n border-top: 1px solid #e6e6e6;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-footer .post-tags {\n padding: 15px 0; }\n .post .post-footer .post-tags a {\n margin-right: 5px;\n color: #c05b4d;\n word-break: break-all; }\n .post .post-footer .post-tags a::before {\n content: '#'; }\n .post .post-footer .post-nav {\n margin: 1em 0; }\n .post .post-footer .post-nav:before, .post .post-footer .post-nav:after {\n content: \" \";\n display: table; }\n .post .post-footer .post-nav:after {\n clear: both; }\n .post .post-footer .post-nav .prev,\n .post .post-footer .post-nav .next {\n font-weight: 600;\n font-size: 18px;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s; }\n .post .post-footer .post-nav .prev {\n float: left; }\n .post .post-footer .post-nav .prev:hover {\n color: #c05b4d;\n transform: translateX(-4px); }\n .post .post-footer .post-nav .next {\n float: right; }\n .post .post-footer .post-nav .next:hover {\n color: #c05b4d;\n transform: translateX(4px); }\n .post .post-footer .post-nav .nav-mobile {\n display: none; }\n @media screen and (max-width: 60em) {\n .post .post-footer .post-nav .nav-default {\n display: none; }\n .post .post-footer .post-nav .nav-mobile {\n display: inline; } }\n .post .disqus-button {\n display: block;\n padding: 15px 0;\n font-size: 16px;\n color: #555;\n border: 1px solid #ddd;\n text-align: center;\n cursor: pointer; }\n\n@media screen and (max-width: 504px) {\n .post {\n padding: 2em 1em; }\n .content-wrapper {\n padding: 0; } }\n\n@media screen and (min-width: 800px) {\n .post {\n margin: 0 5em 3em 5em; } }\n\n.pagination {\n margin: 2em 0; }\n .pagination:before, .pagination:after {\n content: \" \";\n display: table; }\n .pagination:after {\n clear: both; }\n .pagination .prev,\n .pagination .next {\n font-weight: 600;\n font-size: 20px;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s; }\n .pagination .prev {\n float: left; }\n .pagination .prev:hover {\n color: #c05b4d;\n transform: translateX(-4px); }\n .pagination .next {\n float: right; }\n .pagination .next:hover {\n color: #c05b4d;\n transform: translateX(4px); }\n\n.footer {\n margin-top: 2em; }\n .footer .social-links {\n text-align: center; }\n .footer .social-links .iconfont {\n font-size: 30px; }\n .footer .social-links .iconfont + .iconfont {\n margin-left: 10px; }\n .footer .social-links .iconfont:hover {\n color: #c05b4d; }\n .footer .copyright {\n margin: 10px 0;\n color: #8a8a8a;\n text-align: center;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .footer .copyright .hexo-link,\n .footer .copyright .theme-link {\n color: #c05b4d; }\n .footer .copyright .copyright-year {\n display: block; }\n .footer .copyright .copyright-year .heart {\n font-size: 14px; }\n\n.archive {\n margin: 0 5em 3em;\n background-color: white;\n padding: 1em 5em 5em 5em; }\n .archive .archive-title {\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .archive .archive-title.tag, .archive .archive-title.category {\n margin: 20px 0; }\n .archive .archive-title .archive-name {\n margin: 0;\n display: inline-block;\n font-weight: 400;\n font-size: 30px;\n line-height: 32px; }\n .archive .archive-title .archive-post-counter {\n display: none;\n color: #8a8a8a; }\n .archive .collection-title {\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .archive .collection-title .archive-year {\n margin: 2em 0 0;\n font-weight: 400;\n font-size: 28px;\n line-height: 30px; }\n .archive .archive-post {\n padding: 15px 20px 5px 20px;\n border-bottom: 1px solid #cacaca;\n font-size: 1.1em; }\n .archive .archive-post .archive-post-time {\n margin-right: 50px;\n color: #8a8a8a; }\n .archive .archive-post .archive-post-title .archive-post-link {\n color: #c05b4d; }\n .archive .archive-post::first-child {\n margin-top: 10px; }\n .archive .archive-post:hover {\n transition: 0.2s ease-out;\n transform: translateX(4px); }\n .archive .archive-post:hover .archive-post-time {\n color: #717171; }\n .archive .archive-post:hover .archive-post-title .archive-post-link {\n color: #a14639; }\n .archive .more-post .more-post-link {\n margin-top: 1em;\n float: right;\n color: #c05b4d;\n font-size: 1.1em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .archive .more-post .more-post-link:hover {\n border-bottom: 1px solid #c05b4d; }\n\n@media screen and (max-width: 60em) {\n .archive {\n margin-left: auto;\n margin-right: auto;\n padding: 1em; }\n .archive .archive-title .archive-name {\n font-size: 26px; }\n .archive .collection-title .archive-year {\n margin: 10px 0;\n font-size: 24px; }\n .archive .archive-post {\n padding: 5px 10px; }\n .archive .archive-post .archive-post-time {\n font-size: 13px;\n display: block; } }\n\n.tag-cloud {\n margin: 2em 0 3em;\n text-align: center;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .tag-cloud .tag-cloud-title {\n display: inline-block;\n font-size: 24px;\n color: #c05b4d;\n border-bottom: 2px solid #c05b4d; }\n .tag-cloud .tag-cloud-tags {\n margin: 10px 0; }\n .tag-cloud .tag-cloud-tags a {\n display: inline-block;\n position: relative;\n margin: 5px 10px;\n word-wrap: break-word;\n transition-duration: 0.2s;\n transition-property: transform;\n transition-timing-function: ease-out; }\n .tag-cloud .tag-cloud-tags a .tag-count {\n display: inline-block;\n position: relative;\n top: -8px;\n right: -2px;\n color: #c05b4d;\n font-size: 12px; }\n .tag-cloud .tag-cloud-tags a:active, .tag-cloud .tag-cloud-tags a:focus, .tag-cloud .tag-cloud-tags a:hover {\n color: #c05b4d;\n transform: scale(1.1); }\n\n.categories {\n margin: 2em 0 3em;\n text-align: center;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .categories .categories-title {\n display: inline-block;\n font-size: 18px;\n color: #c05b4d;\n border-bottom: 2px solid #c05b4d; }\n .categories .categories-tags {\n margin: 10px 0; }\n .categories .categories-tags .category-link {\n display: inline-block;\n position: relative;\n margin: 5px 10px;\n word-wrap: break-word;\n transition-duration: 0.2s;\n transition-property: transform;\n transition-timing-function: ease-out; }\n .categories .categories-tags .category-link .category-count {\n display: inline-block;\n position: relative;\n top: -8px;\n right: -2px;\n color: #c05b4d;\n font-size: 12px; }\n .categories .categories-tags .category-link:active, .categories .categories-tags .category-link:focus, .categories .categories-tags .category-link:hover {\n color: #c05b4d;\n transform: scale(1.1); }\n\n.slideout-menu {\n position: fixed;\n top: 0;\n left: 0px;\n bottom: 0;\n width: 180px;\n min-height: 100vh;\n overflow-y: hidden;\n -webkit-overflow-scrolling: touch;\n z-index: 0;\n display: none; }\n\n.slideout-panel {\n position: relative;\n z-index: 1;\n background-color: #fefefe;\n min-height: 100%; }\n\n.slideout-open,\n.slideout-open body,\n.slideout-open .slideout-panel {\n overflow: hidden; }\n\n.slideout-open .slideout-menu {\n display: block; }\n\n.mobile-navbar {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 50px;\n background: #fefefe;\n box-shadow: 0px 2px 2px #cacaca;\n text-align: center;\n transition: transform 300ms ease;\n z-index: 99; }\n .mobile-navbar.fixed-open {\n transform: translate3d(180px, 0px, 0px); }\n .mobile-navbar .mobile-header-logo {\n display: inline-block;\n margin-right: 50px; }\n .mobile-navbar .mobile-header-logo .logo {\n font-size: 22px;\n line-height: 50px;\n font-family: \"Chancery\", cursive, LiSu, sans-serif; }\n .mobile-navbar .mobile-navbar-icon {\n color: #c05b4d;\n height: 50px;\n width: 50px;\n font-size: 24px;\n text-align: center;\n float: left;\n position: relative;\n transition: background 0.5s; }\n\n@keyframes clickfirst {\n 0% {\n transform: translateY(6px) rotate(0deg); }\n 100% {\n transform: translateY(0) rotate(45deg); } }\n\n@keyframes clickmid {\n 0% {\n opacity: 1; }\n 100% {\n opacity: 0; } }\n\n@keyframes clicklast {\n 0% {\n transform: translateY(-6px) rotate(0deg); }\n 100% {\n transform: translateY(0) rotate(-45deg); } }\n\n@keyframes outfirst {\n 0% {\n transform: translateY(0) rotate(-45deg); }\n 100% {\n transform: translateY(-6px) rotate(0deg); } }\n\n@keyframes outmid {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@keyframes outlast {\n 0% {\n transform: translateY(0) rotate(45deg); }\n 100% {\n transform: translateY(6px) rotate(0deg); } }\n .mobile-navbar .mobile-navbar-icon span {\n position: absolute;\n /* fallback for browsers which still doesn't support for `calc()` */\n left: 15px;\n top: 25px;\n left: calc((100% - 20px) / 2);\n top: calc((100% - 1px) / 2);\n width: 20px;\n height: 1px;\n background-color: #c05b4d; }\n .mobile-navbar .mobile-navbar-icon span:nth-child(1) {\n transform: translateY(6px) rotate(0deg); }\n .mobile-navbar .mobile-navbar-icon span:nth-child(3) {\n transform: translateY(-6px) rotate(0deg); }\n .mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(1) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: clickfirst; }\n .mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(2) {\n animation-duration: 0.2s;\n animation-fill-mode: both;\n animation-name: clickmid; }\n .mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(3) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: clicklast; }\n .mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(1) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: outfirst; }\n .mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(2) {\n animation-duration: 0.2s;\n animation-fill-mode: both;\n animation-name: outmid; }\n .mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(3) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: outlast; }\n\n.mobile-menu {\n background-color: rgba(248, 245, 236, 0.5); }\n .mobile-menu .mobile-menu-list {\n position: relative;\n list-style: none;\n margin-top: 50px;\n padding: 0;\n border-top: 1px solid #f8f5ec; }\n .mobile-menu .mobile-menu-list .mobile-menu-item {\n padding: 10px 30px;\n border-bottom: 1px solid #f8f5ec; }\n .mobile-menu .mobile-menu-list a {\n font-size: 18px;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .mobile-menu .mobile-menu-list a:hover {\n color: #c05b4d; }\n\n@media screen and (max-width: 60em) {\n .mobile-navbar {\n display: block; } }\n\n.back-to-top {\n display: none;\n position: fixed;\n right: 20px;\n bottom: 20px;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s;\n z-index: 10; }\n .back-to-top:hover {\n transform: translateY(-5px); }\n\n@media screen and (max-width: 60em) {\n .back-to-top {\n display: none !important; } }\n\n.not-found {\n text-align: center; }\n .not-found .error-emoji {\n color: #363636;\n font-size: 3rem; }\n .not-found .error-text {\n color: #797979;\n font-size: 1.25rem; }\n .not-found .error-link {\n margin-top: 2rem; }\n .not-found .error-link a {\n color: #c05b4d; }\n\n\n\n// WEBPACK FOOTER //\n// ./css/style.scss","@import '_common/normalize';\n\nhtml {\n font-size: $global-font-size;\n box-sizing: border-box;\n}\n\nbody {\n padding: 0;\n margin: 0;\n font-family: $global-font-family;\n font-weight: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: $global-lineheight;\n color: $global-font-color;\n background: $global-background;\n scroll-behavior: smooth;\n // border-top: 3px solid $theme-color;\n}\n\n@include max-screen() {\n body {\n border-top: 0;\n }\n}\n\n::selection {\n background: $theme-color;\n color: #fff; \n}\n\n// ::-webkit-scrollbar {\n// width: 8px;\n// height: 6px; \n// }\n\n// ::-webkit-scrollbar-thumb {\n// background: lighten($theme-color, 10%);\n// border-radius: 5px;\n// }\n\n// ::-webkit-scrollbar-track {\n// background: rgba(211, 211, 211, 0.4);\n// border-radius: 5px;\n// }\n\nimg {\n max-width: 100%;\n height: auto;\n display: inline-block;\n vertical-align: middle;\n}\n\na {\n color: $global-font-color;\n text-decoration: none;\n}\n\n@each $header, $size in $global-headings {\n #{$header} {\n font-size: $size;\n font-family: $global-serif-font-family;\n }\n}\n\n.container {\n margin: 0 auto;\n width: $global-body-width;\n}\n\n@include max-screen() {\n .container {\n width: 100%;\n box-shadow: -1px -5px 5px $gray;\n }\n}\n\n.content-wrapper {\n padding: 3em 0 1px 0;\n}\n\n// make video fluid:\n// https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php\n// class video-container is the wrapper used by hexo youtube tag plugin\n.video-container {\n\tposition: relative;\n\tpadding-bottom: 56.25%; /* 16:9 */\n\tpadding-top: 25px;\n\theight: 0;\n}\n.video-container iframe {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n\n.bg-llight {\n background-color: #f2f2f5;\n}\n\n.bg-white {\n background-color: #FFF;\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_base.scss","@mixin clearfix() {\n &:before,\n &:after {\n content: \" \";\n display: table;\n }\n \n &:after {\n clear: both;\n }\n}\n\n@mixin min-screen($min-width: $global-body-width) {\n @media screen and (min-width: $min-width) {\n @content;\n }\n}\n\n@mixin max-screen($max-width: $global-body-width) {\n @media screen and (max-width: $max-width) {\n @content;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_common/_utils.scss","// ==============================\n// Iconfont\n// ==============================\n\n@font-face {\n font-family: 'iconfont'; /* project id 96542 */\n\n src: url('../fonts/iconfont/iconfont.eot');\n src: url('../fonts/iconfont/iconfont.eot#iefix') format('embedded-opentype'), // not '?#iefix', because webpack will add '?hash=[hash]'\n url('../fonts/iconfont/iconfont.woff') format('woff'),\n url('../fonts/iconfont/iconfont.ttf') format('truetype'),\n url('../fonts/iconfont/iconfont.svg#iconfont') format('svg');\n\n // Uncomment these code and comment upper code if you want to use alicdn\n // src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot');\n // src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot?#iefix') format('embedded-opentype'),\n // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.woff') format('woff'),\n // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.ttf') format('truetype'),\n // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.svg#iconfont') format('svg');\n}\n\n.iconfont {\n font-family: \"iconfont\" !important;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -webkit-text-stroke-width: 0.2px;\n -moz-osx-font-smoothing: grayscale;\n cursor: pointer;\n}\n\n.icon-instagram:before {\n font-size: .95em;\n content: \"\\e611\";\n position: relative;\n top: -1px;\n}\n.icon-douban:before {\n content: \"\\e610\";\n}\n.icon-tumblr:before {\n content: \"\\e69f\";\n font-size: .85em;\n position: relative;\n top: -4px;\n}\n.icon-linkedin:before {\n content: \"\\e60d\";\n position: relative;\n top: -4px;\n}\n.icon-twitter:before {\n content: \"\\e600\";\n}\n.icon-weibo:before {\n content: \"\\e602\";\n}\n.icon-stack-overflow:before {\n content: \"\\e603\";\n font-size: .85em;\n position: relative;\n top: -4px;\n}\n.icon-email:before {\n content: \"\\e605\";\n position: relative;\n top: -2px;\n}\n.icon-facebook:before {\n content: \"\\e601\";\n font-size: .95em;\n position: relative;\n top: -2px;\n}\n.icon-github:before {\n content: \"\\e606\";\n position: relative;\n top: -3px;\n}\n.icon-rss:before {\n content: \"\\e604\";\n}\n.icon-google:before {\n content: \"\\e609\";\n}\n.icon-zhihu:before {\n content: \"\\e607\";\n font-size: .9em;\n position: relative;\n top: -2px;\n}\n.icon-pocket:before {\n content: \"\\e856\";\n}\n\n/* Generic Icon */\n.icon-heart:before {\n content: \"\\e608\";\n}\n.icon-right:before {\n content: \"\\e60a\";\n}\n.icon-left:before {\n content: \"\\e60b\";\n}\n.icon-up:before {\n content: \"\\e60c\";\n}\n.icon-close:before {\n content: \"\\e60f\";\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_iconfont.scss","// ==============================\n// Header\n// ==============================\n\n.header {\n @include clearfix; \n\n @import '_header/logo';\n @import '_header/menu';\n}\n\n\n@include max-screen() {\n .header {\n padding: 50px 0 0;\n text-align: center;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_header.scss","// ==============================\n// Logo\n// =============================\n\n.logo-wrapper {\n // text-align: center;\n // border-bottom: 1px solid #f6f6f6;\n float: left;\n\n .logo {\n font-size: $logo-font-size;\n font-family: $logo-font-family;\n }\n}\n\n@include max-screen() {\n .logo-wrapper {\n display: none;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_header/_logo.scss","// ==============================\n// Menu\n// =============================\n\n.site-navbar {\n .menu {\n float: right;\n padding-left: 0;\n font-family: $global-serif-font-family;\n\n .menu-item {\n display: inline-block;\n margin-left: 1em;\n margin-right: 1em;\n\n & + .menu-item {\n margin-left: $menu-item-margin-left;;\n }\n\n @include underline-from-center;\n }\n\n .menu-item-link {\n font-size: $menu-link-font-size;\n }\n }\n}\n\n@include max-screen() {\n .site-navbar {\n display: none;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_header/_menu.scss","@mixin underline-from-center() {\n display: inline-block;\n vertical-align: middle;\n transform: translateZ(0);\n backface-visibility: hidden;\n box-shadow: 0 0 1px transparent;\n position: relative;\n overflow: hidden;\n\n &:before {\n content: '';\n position: absolute;\n z-index: -1;\n height: 2px;\n bottom: 0;\n left: 51%;\n right: 51%;\n background: $theme-color;\n transition-duration: 0.2s;\n transition-property: right, left;\n transition-timing-function: ease-out;\n }\n\n &.active,\n &:active,\n &:focus,\n &:hover {\n &:before {\n right: 0;\n left: 0;\n }\n }\n}\n\n@mixin mobile-menu-icon() {\n @keyframes clickfirst {\n 0% {\n transform: translateY(6px) rotate(0deg);\n \n }\n\n 100% {\n transform: translateY(0) rotate(45deg);\n }\n }\t\n\n @keyframes clickmid {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes clicklast {\n 0% {\n transform: translateY(-6px) rotate(0deg);\n }\n\n 100% {\n transform: translateY(0) rotate(-45deg);\n }\n }\n \n @keyframes outfirst {\n 0% {\n transform: translateY(0) rotate(-45deg);\n }\n\n 100% {\n transform: translateY(-6px) rotate(0deg);\n }\n }\t\n\n @keyframes outmid {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n @keyframes outlast {\n 0% {\n transform: translateY(0) rotate(45deg);\n }\n\n 100% {\n transform: translateY(6px) rotate(0deg);\n }\n }\n\n span {\n position: absolute;\n /* fallback for browsers which still doesn't support for `calc()` */\n left: 15px;\n top: 25px;\n left: calc((100% - 20px) / 2);\n top: calc((100% - 1px) / 2);\n width: 20px;\n height: 1px;\n background-color: $theme-color;\n \n &:nth-child(1) {\n transform: translateY(6px) rotate(0deg);\n }\n\n &:nth-child(3) {\n transform: translateY(-6px) rotate(0deg);\n }\n }\n\n &.icon-click {\n span:nth-child(1) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: clickfirst;\n }\n\n span:nth-child(2) {\n animation-duration: 0.2s;\n animation-fill-mode: both;\n animation-name: clickmid;\n }\n\n span:nth-child(3) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: clicklast;\n }\n }\n\n &.icon-out {\n span:nth-child(1) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: outfirst;\n }\n\n span:nth-child(2) {\n animation-duration: 0.2s;\n animation-fill-mode: both;\n animation-name: outmid;\n }\n\n span:nth-child(3) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: outlast;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_common/_animation.scss","// ==============================\n// Post\n// ==============================\n\n.posts {\n // margin-bottom: $post-list-margin-bottom;\n// border-bottom: $post-border;\n}\n\n.post {\n // padding: $post-padding;\n padding: 3em 5em;\n margin-bottom: 3em;\n \n // & + .post {\n // border-top: $post-border;\n // }\n\n @import '_post/header';\n @import '_post/toc';\n @import '_post/content';\n @import '_post/copyright';\n @import '_post/reward';\n @import '_post/footer';\n @import '_post/disqus';\n}\n\n@media screen and (max-width: 504px) {\n .post {\n padding: 2em 1em;\n }\n\n .content-wrapper {\n padding: 0;\n }\n}\n\n@media screen and (min-width: 800px) {\n .post {\n margin: 0 5em 3em 5em;\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post.scss",".post-header {\n margin-bottom: 20px;\n text-align: center;\n padding-bottom: 10px;\n border-bottom: 2px LightGrey solid;\n\n .post-title {\n margin: 0;\n font-size: $post-title-font-size;\n font-weight: $post-title-font-weight;\n font-family: $global-serif-font-family;\n }\n\n .post-link {\n @include underline-from-center;\n }\n\n .post-meta {\n font-size: 14px;\n color: $post-meta-font-color;\n\n .post-time {\n font-size: 15px;\n }\n\n .post-category {\n display: inline;\n\n a {\n color: inherit;\n\n &::before {\n content: '·';\n }\n\n &:hover {\n color: $theme-color;\n }\n }\n }\n\n .more-meta {\n &::before {\n content: '·';\n }\n }\n\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_header.scss",".post-toc {\n // position: absolute;\n // width: 15em;\n // margin-left: $post-toc-margin-left;\n padding: 10px;\n font-family: $global-serif-font-family;\n border-bottom: 2px LightGrey solid;\n // border-radius: 5px;\n // background: $post-toc-backgroud;\n // box-shadow: 1px 1px 2px rgba(0,0,0,0.125);\n word-wrap: break-word;\n // box-sizing: border-box;\n\n .post-toc-title {\n margin: 0 10px;\n font-size: $post-toc-title-size;\n font-weight: 400;\n text-transform: uppercase;\n }\n\n .post-toc-content {\n font-size: $post-toc-content;\n\n &.always-active ul {\n display: block;\n }\n\n >nav>ul {\n margin: 10px 0;\n }\n\n ul {\n padding-left: 20px;\n list-style: $post-toc-list-style;\n\n li > a {\n color: #139;\n }\n\n li > a:hover{\n color: #900;\n }\n\n ul {\n list-style: circle;\n }\n // ul {\n // padding-left: 15px;\n // display: none;\n // }\n\n // .has-active > ul {\n // display: block;\n // }\n }\n\n .toc-link.active {\n color: $theme-color;\n }\n }\n}\n\n// @include max-screen($toc-max-sreen-width) {\n// .post-toc {\n// display: none;\n// }\n// }\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_toc.scss","// ==============================\n// Post content\n// ==============================\n\n.post-content {\n word-wrap: break-word;\n\n @for $i from 1 through 6 {\n h#{$i} {\n font-weight: 600;\n font-family: $global-serif-font-family;\n }\n }\n\n h1 {\n border-bottom: 1px solid #ddd;\n margin-top: 2em;\n }\n\n h2 {\n // font-size: 1.6em;\n border-bottom: 1px solid #ddd;\n margin-top: 2em;\n }\n\n h3 {\n // font-size: 1.3em;\n margin-top: 1.5em;\n }\n\n a {\n color: $theme-color;\n word-break: break-all;\n\n &:hover {\n border-bottom: $content-link-border;\n }\n\n &.fancybox {\n border: 0;\n }\n }\n\n blockquote {\n margin: 1em 0;\n padding: 1px 20px;\n position: relative;\n color: rgba(#34495e, 0.8);\n background-color: $content-blockquote-backgroud;\n border-left: $content-blockquote-border-left;\n box-shadow: 1px 1px 2px rgba(0,0,0,0.125);\n\n p {\n margin: 0.5em 0;\n }\n\n footer {\n margin: 0.5em 0;\n }\n\n cite:before {\n content: '\\2014';\n padding-right: .3em;\n padding-left: .3em;\n color: #aaa;\n }\n }\n\n img {\n display: inline-block;\n max-width: 100%;\n }\n\n > table {\n max-width: 100%;\n margin: 10px 0;\n border-spacing: 0;\n box-shadow: 2px 2px 3px rgba(0,0,0,.125);\n\n thead {\n background: $deputy-color;\n }\n\n th, td {\n padding: 5px 15px;\n border: 1px double $content-table-border-color;\n }\n\n tr:hover {\n background-color: $deputy-color;\n }\n }\n\n @import 'code';\n\n .post-summary {\n margin-bottom: 1em;\n }\n\n .read-more {\n .read-more-link {\n float: right;\n color: $theme-color;\n font-size: 1.1em;\n font-family: $global-serif-font-family;\n \n &:hover {\n border-bottom: $post-readMore-border-bottom;\n }\n }\n }\n\n kbd {\n display: inline-block;\n padding: 0.25em;\n background-color: #fafafa;\n border: 1px solid #dbdbdb;\n border-bottom-color: #b5b5b5;\n border-radius: 3px;\n box-shadow: inset 0 -1px 0 #b5b5b5;\n font-size: 0.8em;\n line-height: 1.25;\n font-family: \"SFMono-Regular\",\"Liberation Mono\",\"Roboto Mono\",Menlo,Monaco,Consolas,\"Courier New\",Courier,monospace;\n color: #4a4a4a;\n }\n\n dl dt::after {\n content: ':';\n }\n\n figure {\n &.center {\n text-align: center;\n }\n\n figcaption h4 {\n color: #b5b5b5;\n font-size: 0.9rem;\n }\n }\n\n .task-list {\n list-style: none;\n padding-left: 1.5rem;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_content.scss","code, pre {\n padding: 7px;\n font-size: $code-font-size;\n font-family: $code-font-family;\n background: $code-background;\n}\n\ncode {\n padding: 3px 5px;\n border-radius: 4px;\n color: $code-color;\n}\n\n.highlight {\n margin: 1em 0;\n border-radius: 5px;\n overflow-x: auto;\n box-shadow: 1px 1px 2px rgba(0,0,0,0.125);\n position: relative;\n\n table {\n position: relative;\n\n &::after {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n padding: 2px 7px;\n font-size: $code-font-size;\n font-weight: bold;\n color: darken($gray, 10%);\n background: darken($code-background, 3%);\n content: 'Code';\n }\n }\n\n @each $sign, $text in $code-type-list {\n &.#{$sign} > table::after {\n content: $text;\n }\n }\n\n .code {\n pre {\n margin: 0;\n padding: 30px 10px 10px;\n }\n }\n\n .gutter {\n width: 10px;\n color: $gray;\n\n pre {\n margin: 0;\n padding: 30px 7px 10px;\n }\n }\n\n .line {\n // Fix code block null line height and\n // Synchronous gutter and code line highly.\n height: round($code-font-size * 1.5);\n }\n\n table, tr, td {\n margin: 0;\n padding: 0;\n width: 100%;\n border-collapse: collapse;\n }\n\n .code {\n .hljs-comment,\n .hljs-quote {\n color: map-get($code-highlight-color, comment);\n }\n\n .hljs-keyword,\n .hljs-selector-tag,\n .hljs-addition {\n color: map-get($code-highlight-color, keyword);\n }\n\n .hljs-number,\n .hljs-string,\n .hljs-meta .hljs-meta-string,\n .hljs-literal,\n .hljs-doctag,\n .hljs-regexp {\n color: map-get($code-highlight-color, number);\n }\n\n .hljs-title,\n .hljs-section,\n .hljs-name,\n .hljs-selector-id,\n .hljs-selector-class {\n color: map-get($code-highlight-color, title);\n }\n\n .hljs-attribute,\n .hljs-attr,\n .hljs-variable,\n .hljs-template-variable,\n .hljs-class .hljs-title,\n .hljs-type {\n color: map-get($code-highlight-color, attribute);\n }\n\n .hljs-symbol,\n .hljs-bullet,\n .hljs-subst,\n .hljs-meta,\n .hljs-meta .hljs-keyword,\n .hljs-selector-attr,\n .hljs-selector-pseudo,\n .hljs-link {\n color: map-get($code-highlight-color, symbol);\n }\n\n .hljs-built_in,\n .hljs-deletion {\n color: map-get($code-highlight-color, built_in);\n }\n\n .hljs-formula {\n background: map-get($code-highlight-color, formula);\n }\n \n .hljs-emphasis {\n font-style: italic;\n }\n \n .hljs-strong {\n font-weight: bold;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_code.scss",".post-copyright {\n margin-top: 20px;\n padding-top: 10px;\n border-top: 1px dashed $light-gray;\n\n .copyright-item {\n margin: 5px 0;\n\n a {\n color: $theme-color;\n word-wrap: break-word;\n\n &:hover {\n border-bottom: $content-link-border;\n }\n }\n\n .item-title {\n display: inline-block;\n min-width: 5rem;\n margin-right: .5rem;\n text-align: right;\n\n &:after {\n content: \" :\";\n }\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_copyright.scss",".post-reward {\n margin-top: 20px;\n padding-top: 10px;\n text-align: center;\n border-top: 1px dashed $light-gray;\n\n .reward-button {\n margin: 15px 0;\n padding: 3px 7px;\n display: inline-block;\n color: $theme-color;\n border: 1px solid $theme-color;\n border-radius: 5px;\n cursor: pointer;\n\n &:hover {\n color: $white;\n background-color: $theme-color;\n transition: 0.5s;\n }\n }\n\n #reward:checked {\n & ~ .qr-code {\n display: block;\n }\n\n & ~ .reward-button {\n display: none;\n }\n }\n\n .qr-code {\n display: none;\n\n .qr-code-image {\n display: inline-block;\n min-width: 200px;\n width: 40%;\n margin-top: 15px;\n\n span {\n display: inline-block;\n width: 100%;\n margin: 8px 0;\n }\n }\n\n .image {\n width: 200px;\n height: 200px;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_reward.scss","// ==============================\n// Post footer\n// ==============================\n\n.post-footer {\n margin-top: $post-footer-margin-top;\n margin-bottom: 40px;\n border-top: $post-footer-border-top;\n font-family: $global-serif-font-family;\n\n .post-tags {\n padding: $post-tags-padding;\n\n a {\n margin-right: 5px;\n color: $theme-color;\n word-break: break-all;\n\n &::before {\n content: '#';\n }\n }\n }\n\n .post-nav {\n margin: 1em 0;\n @include clearfix;\n\n .prev,\n .next {\n font-weight: 600;\n font-size: $post-nav-font-size;\n font-family: $global-serif-font-family;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s;\n }\n\n .prev {\n float: left;\n\n &:hover {\n color: $theme-color;\n transform: translateX(-4px); \n }\n }\n\n .next {\n float: right;\n\n &:hover {\n color: $theme-color;\n transform: translateX(4px); \n }\n }\n\n .nav-mobile {\n display: none;\n }\n }\n}\n\n@include max-screen() {\n .post-footer {\n .post-nav {\n .nav-default {\n display: none;\n }\n\n .nav-mobile {\n display: inline;\n }\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_footer.scss","// ==============================\n// Post disqus\n// ==============================\n\n.disqus-button {\n display: block;\n padding: 15px 0;\n font-size: 16px;\n color: #555;\n border: 1px solid #ddd;\n text-align: center;\n cursor:pointer;\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_disqus.scss","// ==============================\n// Pagination\n// ==============================\n\n.pagination {\n margin: $pagination-margin;\n @include clearfix;\n\n .prev,\n .next {\n font-weight: 600;\n font-size: $pagination-font-size;\n font-family: $global-serif-font-family;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s;\n }\n\n .prev {\n float: left;\n\n &:hover {\n color: $theme-color;\n transform: translateX(-4px); \n }\n }\n\n .next {\n float: right;\n\n &:hover {\n color: $theme-color;\n transform: translateX(4px); \n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_pagination.scss","// ==============================\n// Post footer\n// =============================\n\n.footer {\n margin-top: $footer-margin-top;\n\n @import \"_footer/social\";\n @import \"_footer/copyright\";\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_footer.scss","// ==============================\n// Social\n// =============================\n\n.social-links {\n text-align: center;\n\n .iconfont {\n font-size: $social-icon-font-size;\n\n & + .iconfont {\n margin-left: $social-link-margin-left;\n } \n\n &:hover {\n color: $theme-color;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_footer/_social.scss","// ==============================\n// Copyright\n// =============================\n\n.copyright {\n margin: $copyright-margin;\n color: $dark-gray;\n text-align: center;\n font-family: $global-serif-font-family;\n\n .hexo-link,\n .theme-link {\n color: $theme-color;\n }\n\n .copyright-year {\n display: block;\n\n .heart {\n font-size: 14px;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_footer/_copyright.scss","// ==============================\n// Archive\n// =============================\n\n.archive {\n // margin: $archive-margin;\n // max-width: $archive-max-width;\n margin: 0 5em 3em;\n background-color: white;\n padding: 1em 5em 5em 5em;\n\n .archive-title {\n font-family: $global-serif-font-family;\n\n &.tag,\n &.category {\n margin: 20px 0;\n }\n\n .archive-name {\n margin: 0;\n display: inline-block;\n font-weight: 400;\n font-size: $archive-name-font-size;\n line-height: $archive-name-font-size + 2px;\n }\n\n .archive-post-counter {\n display: none;\n color: $dark-gray;\n }\n }\n\n .collection-title {\n font-family: $global-serif-font-family;\n \n .archive-year {\n margin: 2em 0 0;\n font-weight: 400;\n font-size: $collection-title-font-size;\n line-height: $collection-title-font-size + 2px;\n }\n }\n\n .archive-post {\n padding: $archive-post-padding;\n border-bottom: $archive-post-border;\n font-size: 1.1em;\n\n .archive-post-time {\n margin-right: 50px;\n color: $dark-gray;\n }\n\n .archive-post-title {\n \n .archive-post-link {\n color: $theme-color;\n }\n }\n\n &::first-child {\n margin-top: 10px;\n }\n\n &:hover {\n // border-left: $archive-post-hover-border-left;\n transition: $archive-post-hover-transition;\n transform: $archive-post-hover-transform;\n\n .archive-post-time {\n color: darken($dark-gray, 10%);\n }\n\n .archive-post-title .archive-post-link {\n color: darken($theme-color, 10%);\n }\n }\n }\n\n .more-post {\n .more-post-link {\n margin-top: 1em;\n float: right;\n color: $theme-color;\n font-size: 1.1em;\n font-family: $global-serif-font-family;\n \n &:hover {\n border-bottom: $post-readMore-border-bottom;\n }\n }\n }\n}\n\n@include max-screen() {\n .archive {\n margin-left: auto;\n margin-right: auto;\n padding: 1em;\n\n .archive-title .archive-name {\n font-size: $archive-name-font-size - 4px;\n }\n\n .collection-title .archive-year {\n margin: 10px 0;\n font-size: $collection-title-font-size - 4px;\n }\n\n .archive-post {\n padding: $archive-post-mobile-padding;\n\n .archive-post-time {\n font-size: $archive-post-mobile-time-font-size;\n display: block;\n }\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_archive.scss","// ==============================\n// Tags\n// =============================\n\n.tag-cloud {\n margin: 2em 0 3em;\n text-align: center;\n font-family: $global-serif-font-family;\n\n .tag-cloud-title {\n display: inline-block;\n font-size: $tag-cloud-title-size;\n color: $theme-color;\n border-bottom: $tag-cloud-title-border-bottom;\n }\n\n .tag-cloud-tags {\n margin: 10px 0;\n\n a {\n display: inline-block;\n position: relative;\n margin: $tag-cloud-tags-link-margin;\n word-wrap: break-word;\n transition-duration: 0.2s;\n transition-property: transform;\n transition-timing-function: ease-out;\n\n .tag-count {\n display: inline-block;\n position: relative;\n top: -8px;\n right: -2px;\n color: $theme-color;\n font-size: $category-count-font-size;\n }\n\n &:active,\n &:focus,\n &:hover {\n color: $theme-color;\n transform: scale(1.1);\n }\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_tags.scss","\n.categories {\n margin: 2em 0 3em;\n text-align: center;\n font-family: $global-serif-font-family;\n\n .categories-title {\n display: inline-block;\n font-size: $categories-title-size;\n color: $theme-color;\n border-bottom: $categories-title-border-bottom;\n }\n\n .categories-tags {\n margin: 10px 0;\n\n .category-link {\n display: inline-block;\n position: relative;\n margin: $categories-tags-link-margin;\n word-wrap: break-word;\n transition-duration: 0.2s;\n transition-property: transform;\n transition-timing-function: ease-out;\n\n .category-count {\n display: inline-block;\n position: relative;\n top: -8px;\n right: -2px;\n color: $theme-color;\n font-size: $category-count-font-size;\n }\n\n &:active,\n &:focus,\n &:hover {\n color: $theme-color;\n transform: scale(1.1);\n }\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_categories.scss","// ==============================\n// slideout (https://github.com/mango/slideout)\n// ==============================\n\n.slideout-menu {\n position: fixed;\n top: 0;\n left: 0px;\n bottom: 0;\n width: 180px;\n min-height: 100vh;\n overflow-y: hidden;\n -webkit-overflow-scrolling: touch;\n z-index: 0;\n display: none;\n}\n\n.slideout-panel {\n position: relative;\n z-index: 1;\n background-color: $white;\n min-height: 100%;\n}\n\n.slideout-open,\n.slideout-open body,\n.slideout-open .slideout-panel {\n overflow: hidden;\n}\n\n.slideout-open .slideout-menu {\n display: block;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_slideout.scss","// ==============================\n// Mobile Navbar\n// ==============================\n\n.mobile-navbar {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: $mobile-navbar-height;\n background: $white;\n box-shadow: 0px 2px 2px $gray;\n text-align: center;\n transition: transform 300ms ease;\n z-index: 99;\n\n &.fixed-open {\n transform: translate3d(180px, 0px, 0px);\n }\n\n .mobile-header-logo {\n display: inline-block;\n margin-right: 50px;\n\n .logo {\n font-size: 22px;\n line-height: $mobile-navbar-height;\n font-family: $logo-font-family;\n }\n }\n\n .mobile-navbar-icon {\n color: $theme-color;\n height: $mobile-navbar-height;\n width: $mobile-navbar-height;\n font-size: 24px;\n text-align: center;\n float: left;\n position: relative;\n transition: background 0.5s;\n\n @include mobile-menu-icon();\n }\n}\n\n.mobile-menu {\n background-color: rgba($deputy-color, 0.5);\n\n .mobile-menu-list {\n position: relative;\n list-style: none;\n margin-top: 50px;\n padding: 0;\n border-top: 1px solid $deputy-color;\n\n .mobile-menu-item {\n padding: 10px 30px;\n border-bottom: 1px solid $deputy-color;\n }\n\n a {\n font-size: 18px;\n font-family: $global-serif-font-family;\n\n &:hover {\n color: $theme-color;\n }\n }\n }\n}\n\n@include max-screen() {\n .mobile-navbar {\n display: block;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_mobile.scss","// ==============================\n// Back to top\n// =============================\n\n.back-to-top {\n display: none;\n position: fixed;\n right: 20px;\n bottom: 20px;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s;\n z-index: 10;\n\n &:hover {\n transform: translateY(-5px); \n }\n}\n\n@include max-screen() {\n .back-to-top {\n display: none !important;\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_back-to-top.scss","// ==============================\n// Archive\n// =============================\n\n.not-found {\n text-align: center;\n\n .error-emoji {\n color: #363636;\n font-size: 3rem;\n }\n\n .error-text {\n color: #797979;\n font-size: 1.25rem;\n }\n\n .error-link {\n margin-top: 2rem;\n\n a {\n color: $theme-color;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_404.scss"],"sourceRoot":""} \ No newline at end of file
+{"version":3,"sources":["webpack:///./css/_variables.scss","webpack:///./css/_common/_normalize.scss","webpack:///./css/style.scss","webpack:///./css/_base.scss","webpack:///./css/_common/_utils.scss","webpack:///./css/_iconfont.scss","webpack:///./css/_partial/_header.scss","webpack:///./css/_partial/_header/_logo.scss","webpack:///./css/_partial/_header/_menu.scss","webpack:///./css/_common/_animation.scss","webpack:///./css/_partial/_post.scss","webpack:///./css/_partial/_post/_header.scss","webpack:///./css/_partial/_post/_toc.scss","webpack:///./css/_partial/_post/_content.scss","webpack:///./css/_partial/_post/_code.scss","webpack:///./css/_partial/_post/_copyright.scss","webpack:///./css/_partial/_post/_reward.scss","webpack:///./css/_partial/_post/_footer.scss","webpack:///./css/_partial/_post/_disqus.scss","webpack:///./css/_partial/_pagination.scss","webpack:///./css/_partial/_footer.scss","webpack:///./css/_partial/_footer/_social.scss","webpack:///./css/_partial/_footer/_copyright.scss","webpack:///./css/_partial/_archive.scss","webpack:///./css/_partial/_tags.scss","webpack:///./css/_partial/_categories.scss","webpack:///./css/_partial/_slideout.scss","webpack:///./css/_partial/_mobile.scss","webpack:///./css/_partial/_back-to-top.scss","webpack:///./css/_partial/_404.scss"],"names":[],"mappings":"AAiFA,WACE,qBACA,kCACA,8QAKA,oBACA,iBAAkB;;AC1FpB,4DAQA,KACE,uBACA,0BACA,6BAA8B,CAqBhC,2FAaE,aAAc,CAQhB,4BAIE,qBACA,uBAAwB,CAQ1B,sBACE,aACA,QAAS,CCQX,kBDEE,YAAa,CAUf,EACE,4BAA6B,CAO/B,iBAEE,SAAU,CAUZ,YACE,wBAAyB,CAO3B,SAEE,eAAiB,CAOnB,IACE,iBAAkB,CAQpB,GACE,cACA,cAAgB,CAOlB,KACE,gBACA,UAAW,CAOb,MACE,aAAc,CAOhB,QAEE,cACA,cACA,kBACA,uBAAwB,CAG1B,IACE,SAAW,CAGb,IACE,aAAe,CAUjB,IACE,QAAS,CAOX,eACE,eAAgB,CAUlB,OACE,eAAgB,CAOlB,GAEE,+BAAuB,uBACvB,QAAS,CAOX,IACE,aAAc,CAOhB,kBAIE,gCACA,aAAc,CAkBhB,sCAKE,cACA,aACA,QAAS,CAOX,OACE,gBAAiB,CAUnB,cAEE,mBAAoB,CAWtB,oEAIE,0BACA,cAAe,CAOjB,sCAEE,cAAe,CAOjB,iDAEE,SACA,SAAU,CAQZ,MACE,kBAAmB,CAWrB,uCAEE,8BAAsB,sBACtB,SAAU,CASZ,4FAEE,WAAY,CASd,mBACE,6BAEA,+BACA,sBAAuB,CASzB,+FAEE,uBAAwB,CAO1B,SACE,wBACA,aACA,0BAA8B,CAQhC,OACE,SACA,SAAU,CAOZ,SACE,aAAc,CAQhB,SACE,eAAiB,CAUnB,MACE,yBACA,gBAAiB,CAGnB,MAEE,SAAU,CEvaZ,KACE,eACA,8BAAsB,sBAGxB,KACE,UACA,SACA,4DACA,gBACA,mCACA,kCACA,gBACA,cACA,mBACA,sBAAuB,CCEtB,qCDGD,KACE,YAAa,CACd,CAGH,iBACE,mBACA,UAAW,CACZ,YAFC,mBACA,UAAW,CAkBb,IACE,eACA,YACA,qBACA,qBAAsB,CAGxB,EACE,cACA,oBAAqB,CAIrB,GACE,eHMO,CGJR,MADC,iDHF+D,CGGhE,GAFC,eHOO,CGLR,GAFC,eHQO,CGNR,MADC,iDHF+D,CGGhE,GAFC,eHSO,CGPR,GAFC,eHUO,CGRR,MADC,iDHF+D,CGGhE,GAFC,aHWK,CGNT,WACE,cACA,YHpBwB,CI7BvB,qCDqDD,WACE,UAAW,CACZ,CAGH,iBACE,iBAAoB,CAMtB,iBACC,kBACA,sBACA,iBACA,QAAS,CAEV,wBACC,kBACA,MACA,OACA,WACA,WAAY,CAGb,WACE,wBAAyB,CAG3B,UACE,qBAAsB,CEnGxB,WACE,qBAEA,kCACA,wMAG4D,CAU9D,UACE,+BACA,kBACA,mCACA,+BACA,kCACA,cAAe,CAGjB,uBACE,gBACA,gBACA,kBACA,QAAS,CAEX,oBACE,eAAgB,CAElB,oBACE,gBACA,gBACA,kBACA,QAAS,CAEX,sBACE,gBACA,kBACA,QAAS,CAEX,qBACE,eAAgB,CAElB,mBACE,eAAgB,CAElB,4BACE,gBACA,gBACA,kBACA,QAAS,CAEX,mBACE,gBACA,kBACA,QAAS,CAEX,sBACE,gBACA,gBACA,kBACA,QAAS,CAEX,oBACE,gBACA,kBACA,QAAS,CAEX,iBACE,eAAgB,CAElB,oBACE,eAAgB,CAElB,mBACE,gBACA,eACA,kBACA,QAAS,CAEX,oBACE,eAAgB,CAIlB,mBACE,eAAgB,CAElB,mBACE,eAAgB,CAElB,kBACE,eAAgB,CAElB,gBACE,eAAgB,CAElB,mBACE,eAAgB,CACjB,6BD1GG,YACA,aAAc,CAGhB,cACE,UAAW,CEJf,sBCCE,WACA,iBAAkB,CAMnB,4BAHG,eACA,4BPuFoD,COtFrD,qCDPH,sBCYI,YAAa,CACd,4BCXC,YACA,mBACA,iDRoD+D,CQnChE,sCAbG,gBACA,iBCZJ,qBACA,sBACA,gCAAwB,wBACxB,mCAA2B,2BAC3B,uCAA+B,+BAC/B,kBACA,eAAgB,CDab,iDAJG,gBRoFoB,CQnFrB,6CCPH,WACA,kBACA,WACA,WACA,SACA,SACA,UACA,mBACA,gCAAyB,wBACzB,uCAAgC,+BAChC,4CAAoC,oCACrC,8MAOG,QACA,MAAO,CACR,2CDPC,cRmFoB,CQlFrB,qCFpBL,qBE0BI,YAAa,CACd,sCFlBD,QACE,iBACA,iBAAkB,CACnB,CIPH,MACE,gBACA,gBAAiB,CAalB,mBCvBC,mBACA,kBACA,oBACA,+BAAkC,CA4CnC,+BAzCG,SACA,gBACA,gBACA,iDXkD+D,CWjDhE,8BFVD,qBACA,sBACA,gCAAwB,wBACxB,mCAA2B,2BAC3B,uCAA+B,+BAC/B,kBACA,eAAgB,CEQf,qCFLC,WACA,kBACA,WACA,WACA,SACA,SACA,UACA,mBACA,gCAAyB,wBACzB,uCAAgC,+BAChC,4CAAoC,oCCXxC,8KDmBM,QACA,MAAO,CCpBb,8BCSI,eACA,aXkBe,CWUhB,yCAzBG,cAAe,CAChB,6CAGC,cAAe,CAahB,+CAVG,aAAc,CASf,sDANG,aAAa,sDAIb,aXzBU,CW0BX,gDAMD,aAAa,iBCvCnB,aACA,kDACA,gCAIA,oBAAqB,CAkDtB,gCA9CG,cACA,eACA,gBACA,wBAAyB,CAC1B,kCAGC,cZ8ImB,CYxGpB,mDAnCG,aAAc,CACf,yCAGC,aAAc,CACf,qCAGC,kBACA,iBZqIsB,CYhHvB,0CAlBG,UAAW,CACZ,gDAGC,UAAW,CACZ,wCAGC,iBAAkB,CACnB,mDAYD,aZ9Cc,CY+Cf,oBCrDH,oBAAqB,CA6ItB,0IAzIK,gBACA,iDbkD6D,CajD9D,8CAUD,6BACA,cAAe,CAChB,uBAIC,gBAAiB,CAClB,sBAGC,cACA,oBAAqB,CAStB,4BANG,+BbxBc,CayBf,+BAGC,QAAS,CACV,+BAID,aACA,iBACA,kBACA,wBACA,qCACA,yCACA,gDAAyC,wCAgB1C,uEATG,aAAe,CAChB,2CAGC,gBACA,mBACA,kBACA,UAAW,CACZ,wBAID,qBACA,cAAe,CAChB,0BAGC,eACA,cACA,iBACA,gDAAwC,wCAczC,gCAXG,kBbrEsB,CasEvB,0DAGC,iBACA,yBboGgD,CanGjD,mCAGC,wBb9EsB,Ca+EvB,iDCzFH,YACA,eACA,4CACA,kBdO0B,CcN3B,yBAGC,gBACA,kBACA,admLkB,CclLnB,+BAGC,aACA,kBACA,gBACA,gDAAyC,wCACzC,iBAAkB,CAyHnB,qCAtHG,iBAAkB,CAcnB,2CAXG,kBACA,MACA,QACA,OACA,gBACA,eACA,gBACA,cACA,mBACA,cAAe,CAChB,yDAKC,cd6KiB,Cc5KlB,sDADC,Wd8KW,Cc7KZ,uDADC,Yd+Ka,Cc9Kd,wDADC,adgLe,Cc/KhB,wDADC,adiLe,CchLhB,iEADC,sBdkLiC,CcjLlC,yDADC,cdmLiB,CclLlB,wDADC,adoLe,CcnLhB,yDADC,cdqLiB,CcpLlB,yDADC,cdsLiB,CcrLlB,yDADC,cduLiB,CctLlB,sHADC,oBdyL6B,CcxL9B,6DADC,kBd0LyB,CczL1B,6DADC,kBd2LyB,Cc1L1B,+DADC,qBd4L8B,Cc3L/B,wDADC,ad6Le,Cc5LhB,yDADC,cd8LiB,Cc7LlB,2DADC,gBd+LqB,Cc9LtB,yDADC,cdgMiB,Cc/LlB,wDADC,adiMe,CchMhB,0DADC,edkMmB,CcjMpB,2DADC,gBdoMqB,CcnMtB,uDADC,YdqMa,CcpMd,2DADC,gBdsMqB,CcrMtB,4DADC,iBduMuB,CctMxB,2DADC,gBdwMqB,CcvMtB,yDADC,cdyMiB,CcxMlB,yDADC,cd0MiB,CczMlB,wDADC,ad2Me,Cc1MhB,2DADC,gBd4MqB,Cc3MtB,yDADC,cd6MiB,Cc5MlB,yDADC,cd8MiB,Cc7MlB,0DADC,ed+MmB,Cc9MpB,0DADC,edgNmB,Cc/MpB,+DADC,oBdiN6B,CchN9B,iHADC,cdmNiB,CclNlB,yDADC,cdoNiB,CcnNlB,yCAKC,SACA,sBAAuB,CACxB,uCAID,WACA,adhBU,CcsBX,2CAHG,SACA,qBAAsB,CACvB,qCAMD,WAAoC,CACrC,yGAGC,SACA,UACA,WACA,wBAAyB,CAC1B,oGAKG,ad2HY,Cc1Hb,+JAKC,adsHY,CcrHb,6TAQC,ad8GW,Cc7GZ,qQAOC,aduGU,CctGX,mUAQC,ad+Fc,Cc9Ff,uaAUC,adqFW,CcpFZ,wGAIC,adiFa,CchFd,mDAGC,kBd8EY,Cc7Eb,oDAGC,iBAAkB,CACnB,kDAGC,eAAiB,CAClB,kCDzCD,iBAAkB,CACnB,+BAGC,gBAAiB,CAWlB,+CARG,cACA,gBACA,iDb7C6D,CakD9D,qDAFG,+BbjGY,CakGb,wBAKH,qBACA,cACA,yBACA,yBACA,4BACA,kBACA,0CAAkC,kCAClC,eACA,iBACA,2GACA,aAAc,CACf,gCAGC,WAAY,CACb,kCAIG,iBAAkB,CACnB,yCAGC,cACA,eAAiB,CAClB,+BAID,gBACA,mBAAoB,CACrB,sBEhJD,gBACA,iBACA,6BfgCkB,CePnB,sCAtBG,YAAa,CAqBd,wCAlBG,cACA,oBAAqB,CAKtB,8CAFG,+BfFY,CeGb,kDAID,qBACA,eACA,mBACA,gBAAiB,CAKlB,wDAFG,YAAa,CACd,mBCxBL,gBACA,iBACA,kBACA,6BhB+BkB,CgBkBnB,kCA9CG,cACA,gBACA,qBACA,cACA,yBACA,kBACA,cAAe,CAOhB,wCAJG,cACA,yBACA,uBAAgB,eACjB,4CAKC,aAAc,CACf,8EAQD,YAAa,CAmBd,2CAhBG,qBACA,gBACA,UACA,eAAgB,CAOjB,gDAJG,qBACA,WACA,YAAa,CACd,mCAID,YACA,YAAa,CACd,mBC9CH,gBACA,mBACA,6BACA,iDjBoDiE,CiBAlE,8BAjDG,cjBoIsB,CiBzHvB,gCARG,iBACA,cACA,oBAAqB,CAKtB,uCAFG,WAAY,CACb,6BAKH,YAAa,CAkCd,uEbxDC,YACA,aAAc,CMKlB,mCNDI,UAAW,CMCf,sEOqBM,gBACA,eACA,kDACA,8CAA8B,oHAC9B,4CAAoC,oCACpC,gCAAyB,wBAC1B,mCAGC,UAAW,CAMZ,yCAHG,cACA,mCAA2B,0DAC5B,mCAID,WAAY,CAMb,yCAHG,cACA,kCAA0B,wDAC3B,yCAID,YAAa,CACd,qCPjDL,0COyDQ,YAAa,CACd,yCAGC,cAAe,CAChB,sBClEL,cACA,eACA,eACA,WACA,sBACA,kBACA,cAAc,CACf,oCReC,MACE,YACA,cAAe,CAGjB,iBACE,iBAAkB,CACnB,CAGH,2DACE,MACE,gBAAiB,CAGnB,iBACE,iBAAkB,CACnB,CAGH,0DACE,MACE,YACA,gBAAiB,CAGnB,iBACE,iBAAkB,CACnB,CSnDH,YACE,aACA,iBAAkB,CAyDnB,qCf5DG,YACA,aAAc,CAGhB,kBACE,UAAW,CeJf,eAMI,oBAAqB,CAetB,iBAZG,sBACA,iBACA,kBACA,sBACA,WACA,WACA,uBACA,iBACA,kBACA,qBACA,kBAAoB,CACrB,sBAKC,sBACA,kBACA,WACA,eACA,SAAU,CACX,qCAgCH,YACE,YAAa,CACd,CChEH,QACE,cpBuQqB,CoBnQtB,sBCJC,iBAAkB,CAanB,gCAVG,crB0QwB,CqBjQzB,0CANG,gBrBoQwB,CqBnQzB,sCAGC,arBJc,CqBKf,mBCXH,cACA,cACA,kBACA,iDtBoDiE,CsBtClE,6DAVG,atBDgB,CsBEjB,mCAGC,aAAc,CAKf,0CAFG,cAAe,CCfrB,SAGE,iBACA,sBACA,mBAAwB,CAqFzB,wBAlFG,iDvBgD+D,CuB7BhE,6DAfG,aAAc,CACf,sCAGC,SACA,qBACA,gBACA,eACA,gBAA0C,CAC3C,8CAGC,aACA,avBQa,CuBPd,2BAID,iDvB0B+D,CuBlBhE,yCALG,eACA,gBACA,eACA,gBAA8C,CAC/C,uBAID,sBACA,gCACA,eAAgB,CA+BjB,0CA5BG,kBACA,avBda,CuBed,8DAKG,avB9CY,CuB+Cb,oCAID,eAAgB,CACjB,6BAIC,wDACA,yFvBkPwC,CuBzOzC,gDANG,aAA8B,CAC/B,oEAGC,aAAgC,CACjC,oBAKH,gBAAiB,CAYlB,oCATG,eACA,cACA,gBACA,iDvB3B6D,CuBgC9D,0CAFG,+BvB/EY,CuBqFpB,oCACE,SACE,kBACA,WAAY,CAmBb,sCAhBG,cAAwC,CACzC,yCAGC,cACA,cAA4C,CAC7C,uBAGC,gBvB0LgC,CuBpLjC,0CAHG,eACA,aAAc,CACf,CChHP,WACE,iBACA,kBACA,iDxBqDiE,CwBflE,4BAnCG,qBACA,eACA,cACA,+BxBFgB,CwBGjB,2BAGC,aAAc,CA2Bf,6BAxBG,qBACA,kBACA,gBACA,qBACA,gCAAyB,wBACzB,8CAA8B,oHAC9B,4CAAoC,oCAiBrC,wCAdG,qBACA,kBACA,SACA,WACA,cACA,cxB6SuB,CwB5SxB,0GAKC,cACA,6BAAqB,8CCxC7B,YACE,iBACA,kBACA,iDzBwDiE,CyBlBlE,8BAnCG,qBACA,eACA,cACA,+BzBCgB,CyBAjB,6BAGC,aAAc,CA2Bf,4CAxBG,qBACA,kBACA,gBACA,qBACA,gCAAyB,wBACzB,8CAA8B,oHAC9B,4CAAoC,oCAiBrC,4DAdG,qBACA,kBACA,SACA,WACA,cACA,czBgTuB,CyB/SxB,uJAKC,cACA,6BAAqB,8CClC7B,eACE,eACA,MACA,OACA,SACA,YACA,iBACA,kBACA,iCACA,UACA,YAAa,CAGf,gBACE,kBACA,UACA,yBACA,eAAgB,CAGlB,kEAGE,eAAgB,CAGlB,8BACE,aAAc,CC3BhB,eACE,aACA,eACA,MACA,OACA,WACA,YACA,mBACA,kEACA,kBACA,8CAAgC,6HAChC,UAAW,CA6BZ,0BA1BG,yCAAuC,iCACxC,mCAGC,qBACA,iBAAkB,CAOnB,yCAJG,eACA,iBACA,4B3BqEkD,C2BpEnD,mCAID,cACA,YACA,WACA,eACA,kBACA,WACA,kBACA,kCAA2B,0BAG5B,8BlBPC,GACE,+CAAuC,uCAIzC,GACE,8CAAsC,6DANxC,GACE,+CAAuC,uCAIzC,GACE,8CAAsC,uCAI1C,4BACE,GACE,SAAU,CAGZ,GACE,SAAU,sBALZ,GACE,SAAU,CAGZ,GACE,SAAU,EAId,6BACE,GACE,gDAAwC,wCAG1C,GACE,+CAAuC,6DALzC,GACE,gDAAwC,wCAG1C,GACE,+CAAuC,wCAI3C,4BACE,GACE,+CAAuC,uCAGzC,GACE,gDAAwC,6DAL1C,GACE,+CAAuC,uCAGzC,GACE,gDAAwC,yCAI5C,0BACE,GACE,SAAU,CAGZ,GACE,SAAU,oBALZ,GACE,SAAU,CAGZ,GACE,SAAU,EAId,2BACE,GACE,8CAAsC,sCAGxC,GACE,+CAAuC,2DALzC,GACE,8CAAsC,sCAGxC,GACE,+CAAuC,wCAI3C,wCACE,kBAEA,UACA,SACA,6BACA,2BACA,WACA,WACA,wBT9FgB,CSuGjB,oDANG,+CAAuC,kFACxC,qDAGC,gDAAwC,oFAK1C,+DACE,+BAAwB,uBACxB,iCAAyB,yBACzB,kCAA0B,0BAG5B,gEACE,+BAAwB,uBACxB,iCAAyB,yBACzB,gCAAwB,wBAG1B,gEACE,+BAAwB,uBACxB,iCAAyB,yBACzB,iCAAyB,yBAK3B,6DACE,+BAAwB,uBACxB,iCAAyB,yBACzB,gCAAwB,wBAG1B,8DACE,+BAAwB,uBACxB,iCAAyB,yBACzB,8BAAsB,sBAGxB,8DACE,+BAAwB,uBACxB,iCAAyB,yBACzB,+BAAuB,uBkB1G7B,aACE,oC3BpC0B,C2B2D3B,+BApBG,kBACA,gBACA,gBACA,UACA,4B3B3CwB,C2B0DzB,iDAZG,kBACA,+B3B/CsB,C2BgDvB,iCAGC,eACA,iD3BH6D,C2BQ9D,uCAFG,a3BvDY,C2BwDb,qCAML,eACE,aAAc,CACf,CCvEH,aACE,aACA,eACA,WACA,YACA,8CAA8B,oHAC9B,4CAAoC,oCACpC,gCAAyB,wBACzB,UAAW,CAKZ,mBAFG,mCAA2B,0DAC5B,qCAID,aACE,sBAAwB,CACzB,CClBH,WACE,iBAAkB,CAmBnB,wBAhBG,cACA,cAAe,CAChB,uBAGC,cACA,iBAAkB,CACnB,uBAGC,eAAgB,CAKjB,yBAFG,a7BVc,C6BWf","file":"jane.min.css","sourcesContent":["// ==============================\n// Variables\n// ==============================\n\n// ========== Theme Color ========== //\n// Config here to change theme color\n// Default | Mint Green | Cobalt Blue | Hot Pink | Dark Violet\n$theme-color-config: 'Default';\n\n// Default theme color map\n$theme-color-map: (\n 'Default': #c05b4d #f8f5ec,\n 'Mint Green': #16982B #f5f5f5,\n 'Cobalt Blue': #0047AB #f0f2f5,\n 'Hot Pink': #FF69B4 #f8f5f5,\n 'Dark Violet': #9932CC #f5f4fa\n);\n\n// Check theme color config.\n// if it does not exist, use default theme color.\n@if not(map-has-key($theme-color-map, $theme-color-config)) {\n $theme-color-config: 'Default';\n}\n$theme-color-list: map-get($theme-color-map, $theme-color-config);\n\n// Default theme color of the site.\n$theme-color: nth($theme-color-list, 1) !default;\n\n// Deputy theme color of the site.\n$deputy-color: nth($theme-color-list, 2) !default;\n\n\n// ========== Color ========== //\n$black: #0a0a0a !default;\n$white: #fefefe !default;\n$light-gray: #e6e6e6 !default;\n$gray: #cacaca !default;\n$dark-gray: #8a8a8a !default;\n\n\n// ========== Global ========== //\n// Text color of the body.\n$global-font-color: #34495e !default;\n\n// Font size attribute applied to '<html>' and '<body>'.\n$global-font-size: 18px !default;\n\n// Global width of '<body>'.\n$global-body-width: 1080px !default;\n\n// Padding of container main\n$global-container-padding: 0 20px !default;\n\n// Default line height for all type. `$global-lineheight` is 24px while `$global-font-size` is 16px.\n$global-lineheight: 1.8 !default;\n\n// Font family of the site.\n$global-font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif !default;\n\n// Serif font family of the site.\n$global-serif-font-family: Athelas, STHeiti, Microsoft Yahei, serif !default;\n\n// Background color of the site.\n$global-background: $white !default;\n\n// Headings font size of the site.\n$global-headings: (\n h1: 1.6em,\n h2: 1.5em,\n h3: 1.3em,\n h4: 1.2em,\n h5: 1.1em,\n h6: 1em\n) !default;\n\n\n// ========== Header ========== //\n// Padding of the site header.\n// $header-padding: 20px 20px !default;\n\n// Font family: Chancery\n@font-face {\n font-family: 'Chancery';\n src: url('../fonts/chancery/apple-chancery-webfont.eot');\n src: local('Apple Chancery'), url('../fonts/chancery/apple-chancery-webfont.eot?#iefix') format('embedded-opentype'),\n url('../fonts/chancery/apple-chancery-webfont.woff2') format('woff2'),\n url('../fonts/chancery/apple-chancery-webfont.woff') format('woff'),\n url('../fonts/chancery/apple-chancery-webfont.ttf') format('truetype'),\n url('../fonts/chancery/apple-chancery-webfont.svg#apple-chancery') format('svg');\n font-weight: lighter;\n font-style: normal;\n}\n\n// Font size of the logo.\n$logo-font-size: 36px !default;\n\n// Font family of the logo.\n$logo-font-family: 'Chancery', cursive, LiSu, sans-serif !default;\n\n// Margin of menu item.\n$menu-item-margin-left: 10px !default;\n\n// Margin of menu item in mobile.\n$menu-item-mobile-margin: 5px !default;\n\n// Font size of menu item link.\n$menu-link-font-size: 18px !default;\n\n// Height of the mobile header.\n$mobile-navbar-height: 50px !default;\n\n// ========== Post ========== //\n// Margin bottom of post list.\n$post-list-margin-bottom: 20px !default;\n\n// Padding of the post.\n$post-padding: 1.5em 0 !default;\n\n// Border top of the post + post.\n$post-border: 1px solid $light-gray !default;\n\n// Font size of post title.\n$post-title-font-size: 1.8em !default;\n\n// Font weight of post title.\n$post-title-font-weight: 400 !default;\n\n// Margin top of the post meta (post time).\n$post-meta-margin-top: 5px !default;\n\n// Font color of the post meta.\n$post-meta-font-color: $dark-gray !default;\n\n// Border bottom of the read more link when hover it.\n$post-readMore-border-bottom: 1px solid $theme-color !default;\n\n// Margin top of the post footer.\n$post-footer-margin-top: 20px !default;\n\n// Border top of post footer.\n$post-footer-border-top: 1px solid $light-gray !default;\n\n// Padding of the post tags.\n$post-tags-padding: 15px 0 !default;\n\n// Font size of post pagination.\n$post-nav-font-size: 18px !default;\n\n\n// ========== TOC ========== //\n// Width of the post toc.\n$post-toc-width: 200px !default;\n\n// Backgroud color of the post toc.\n$post-toc-backgroud: rgba($deputy-color, 0.6) !default;\n\n// Margin left of the post toc.\n//$post-toc-margin-left: $global-body-width - 15px !default;\n\n// Font size of the post toc title.\n$post-toc-title-size: 20px !default;\n\n// Font size of the post toc content.\n$post-toc-content: 15px !default;\n\n// List style of the post toc list.\n$post-toc-list-style: square !default;\n\n// Max screen media of the post toc.\n// $toc-max-sreen-width: 2 * $post-toc-width + $post-toc-margin-left !default;\n\n// ========== Content ========== //\n// Headings anchor.\n$content-headings-anchor: \"\" !default;\n\n// Border bottom of the link when hover it.\n$content-link-border: 1px solid $theme-color !default;\n\n// Background color of the blockquote.\n$content-blockquote-backgroud: rgba($theme-color, 0.05) !default;\n\n// Border left of the blockquote.\n$content-blockquote-border-left: 3px solid rgba($theme-color, 0.3) !default;\n\n// Border color of the table.\n$content-table-border-color: darken($deputy-color, 3%) !default;\n\n// ========== Code ========== //\n// Color of the code.\n$code-color: #c7254e !default;\n\n// Font size of code.\n$code-font-size: 13px !default;\n\n// Font family of the code.\n$code-font-family: Consolas, Monaco, Menlo, Consolas, monospace !default;\n\n// Color of code highlight, solarized.\n$code-highlight-color: (\n comment: #93a1a1,\n keyword: #859900,\n number: #2aa198,\n title: #268bd2,\n attribute: #b58900,\n symbol: #cb4b16,\n built_in: #dc322f,\n formula: #eee8d5\n) !default;\n\n// Code type list.\n$code-type-list: (\n // Custom code type\n language-bash: \"Bash\",\n language-c: \"C\",\n language-cs: \"C#\",\n language-cpp: \"C++\",\n language-css: \"CSS\",\n language-coffeescript: \"CoffeeScript\",\n language-html: \"HTML\",\n language-xml: \"XML\",\n language-http: \"HTTP\",\n language-json: \"JSON\",\n language-java: \"Java\",\n language-js: \"JavaScript\",\n language-javascript: \"JavaScript\",\n language-makefile: \"Makefile\",\n language-markdown: \"Markdown\",\n language-objectivec: \"Objective-C\",\n language-php: \"PHP\",\n language-perl: \"Perl\",\n language-python: \"Python\",\n language-ruby: \"Ruby\",\n language-sql: \"SQL\",\n language-shell: \"Shell\",\n\n language-erlang: \"Erlang\",\n language-go: \"Go\",\n language-groovy: \"Groovy\",\n language-haskell: \"Haskell\",\n language-kotlin: \"Kotlin\",\n language-less: \"Less\",\n language-lisp: \"Lisp\",\n language-lua: \"Lua\",\n language-matlab: \"Matlab\",\n language-rust: \"Rust\",\n language-scss: \"Scss\",\n language-scala: \"Scala\",\n language-swift: \"Swift\",\n language-typescript: \"TypeScript\",\n language-yml: \"YAML\",\n language-yaml: \"YAML\",\n language-toml: \"TOML\"\n) !default;\n\n// Color of the code background.\n$code-background: $deputy-color !default;\n\n\n// ========== Pagination ========== //\n// Margin of the pagination.\n$pagination-margin: 2em 0 !default;\n\n// Font size of the pagination (Without post, post pagination see line 140).\n$pagination-font-size: 20px !default;\n\n\n// ========== Footer ========== //\n// Margin top of the footer.\n$footer-margin-top: 2em !default;\n\n// Margin left of the social link.\n$social-link-margin-left: 10px !default;\n\n// Font size of the social icon.\n$social-icon-font-size: 30px !default;\n\n// Margin of the copyright.\n$copyright-margin: 10px 0 !default;\n\n\n// ========== Archive ========== //\n// Margin of the archive.\n$archive-margin: 2em 0px !default;\n\n// Max width of the archive.\n$archive-max-width: 550px !default;\n\n// Font size of the archive name.\n$archive-name-font-size: 30px !default;\n\n// Font size of the collection title.\n$collection-title-font-size: 28px !default;\n\n// Padding of the archive post.\n$archive-post-padding: 15px 20px 5px 20px !default;\n\n// Padding of the archive post in mobile.\n$archive-post-mobile-padding: 5px 10px !default;\n\n// Font size of the archive post time in mobile.\n$archive-post-mobile-time-font-size: 13px !default;\n\n// Border left of the archive post, use $archive-post-hover-border-left when hover it.\n$archive-post-border: 1px solid $gray !default;\n$archive-post-hover-border-left: 3px solid $theme-color !default;\n\n// Transition of the archive post when hover it.\n$archive-post-hover-transition: 0.2s ease-out !default;\n\n// Transform of the archive post when hover it.\n$archive-post-hover-transform: translateX(4px) !default;\n\n\n// ========== Tags ========== //\n// Font soze of the tag cloud title.\n$tag-cloud-title-size: 24px !default;\n\n// Border bottom of the tag cloud title.\n$tag-cloud-title-border-bottom: 2px solid $theme-color !default;\n\n// Margin of the tag cloud tags link.\n$tag-cloud-tags-link-margin: 5px 10px !default;\n\n\n// ========== Categories ========== //\n// Font soze of the categories title.\n$categories-title-size: 18px !default;\n\n// Border bottom of the categories title.\n$categories-title-border-bottom: 2px solid $theme-color !default;\n\n// Margin of the categories tags link.\n$categories-tags-link-margin: 5px 10px !default;\n\n// Font size of the category count\n$category-count-font-size: 12px !default;\n\n\n\n// WEBPACK FOOTER //\n// ./css/_variables.scss","/*! normalize.css v3.0.2 | MIT License | git.io/normalize */\n\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n * user zoom.\n */\n\nhtml {\n font-family: sans-serif; /* 1 */\n -ms-text-size-adjust: 100%; /* 2 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Remove default margin.\n */\n\nbody {\n margin: 0;\n}\n\n/* HTML5 display definitions\n ========================================================================== */\n\n/**\n * Correct `block` display not defined for any HTML5 element in IE 8/9.\n * Correct `block` display not defined for `details` or `summary` in IE 10/11\n * and Firefox.\n * Correct `block` display not defined for `main` in IE 11.\n */\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n display: block;\n}\n\n/**\n * 1. Correct `inline-block` display not defined in IE 8/9.\n * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\n */\n\naudio,\ncanvas,\nprogress,\nvideo {\n display: inline-block; /* 1 */\n vertical-align: baseline; /* 2 */\n}\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\n/**\n * Address `[hidden]` styling not present in IE 8/9/10.\n * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.\n */\n\n[hidden],\ntemplate {\n display: none;\n}\n\n/* Links\n ========================================================================== */\n\n/**\n * Remove the gray background color from active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * Improve readability when focused and also mouse hovered in all browsers.\n */\n\na:active,\na:hover {\n outline: 0;\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Address styling not present in IE 8/9/10/11, Safari, and Chrome.\n */\n\nabbr[title] {\n border-bottom: 1px dotted;\n}\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * Address styling not present in Safari and Chrome.\n */\n\ndfn {\n font-style: italic;\n}\n\n/**\n * Address variable `h1` font-size and margin within `section` and `article`\n * contexts in Firefox 4+, Safari, and Chrome.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/**\n * Address styling not present in IE 8/9.\n */\n\nmark {\n background: #ff0;\n color: #000;\n}\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsup {\n top: -0.5em;\n}\n\nsub {\n bottom: -0.25em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove border when inside `a` element in IE 8/9/10.\n */\n\nimg {\n border: 0;\n}\n\n/**\n * Correct overflow not hidden in IE 9/10/11.\n */\n\nsvg:not(:root) {\n overflow: hidden;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * Address margin not present in IE 8/9 and Safari.\n */\n\nfigure {\n margin: 1em 40px;\n}\n\n/**\n * Address differences between Firefox and other browsers.\n */\n\nhr {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n height: 0;\n}\n\n/**\n * Contain overflow in all browsers.\n */\n\npre {\n overflow: auto;\n}\n\n/**\n * Address odd `em`-unit font size rendering in all browsers.\n */\n\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * Known limitation: by default, Chrome and Safari on OS X allow very limited\n * styling of `select`, unless a `border` property is set.\n */\n\n/**\n * 1. Correct color not being inherited.\n * Known issue: affects color of disabled elements.\n * 2. Correct font properties not being inherited.\n * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n color: inherit; /* 1 */\n font: inherit; /* 2 */\n margin: 0; /* 3 */\n}\n\n/**\n * Address `overflow` set to `hidden` in IE 8/9/10/11.\n */\n\nbutton {\n overflow: visible;\n}\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.\n * Correct `select` style inheritance in Firefox.\n */\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n * and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n * `input` and others.\n */\n\nbutton,\nhtml input[type=\"button\"], /* 1 */\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n -webkit-appearance: button; /* 2 */\n cursor: pointer; /* 3 */\n}\n\n/**\n * Re-set default cursor for disabled elements.\n */\n\nbutton[disabled],\nhtml input[disabled] {\n cursor: default;\n}\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n border: 0;\n padding: 0;\n}\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\n\ninput {\n line-height: normal;\n}\n\n/**\n * It's recommended that you don't attempt to style these elements.\n * Firefox's implementation doesn't respect box-sizing, padding, or width.\n *\n * 1. Address box sizing set to `content-box` in IE 8/9/10.\n * 2. Remove excess padding in IE 8/9/10.\n */\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Fix the cursor style for Chrome's increment/decrement buttons. For certain\n * `font-size` values of the `input`, it causes the cursor style of the\n * decrement button to change from `default` to `text`.\n */\n\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari and Chrome\n * (include `-moz` to future-proof).\n */\n\ninput[type=\"search\"] {\n -webkit-appearance: textfield; /* 1 */\n -moz-box-sizing: content-box;\n -webkit-box-sizing: content-box; /* 2 */\n box-sizing: content-box;\n}\n\n/**\n * Remove inner padding and search cancel button in Safari and Chrome on OS X.\n * Safari (but not Chrome) clips the cancel button when the search input has\n * padding (and `textfield` appearance).\n */\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * Define consistent border, margin, and padding.\n */\n\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9/10/11.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\n\nlegend {\n border: 0; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Remove default vertical scrollbar in IE 8/9/10/11.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * Don't inherit the `font-weight` (applied by a rule above).\n * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\n */\n\noptgroup {\n font-weight: bold;\n}\n\n/* Tables\n ========================================================================== */\n\n/**\n * Remove most spacing between table cells.\n */\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\ntd,\nth {\n padding: 0;\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_common/_normalize.scss","@charset \"UTF-8\";\n@font-face {\n font-family: 'Chancery';\n src: url(\"../fonts/chancery/apple-chancery-webfont.eot\");\n src: local(\"Apple Chancery\"), url(\"../fonts/chancery/apple-chancery-webfont.eot?#iefix\") format(\"embedded-opentype\"), url(\"../fonts/chancery/apple-chancery-webfont.woff2\") format(\"woff2\"), url(\"../fonts/chancery/apple-chancery-webfont.woff\") format(\"woff\"), url(\"../fonts/chancery/apple-chancery-webfont.ttf\") format(\"truetype\"), url(\"../fonts/chancery/apple-chancery-webfont.svg#apple-chancery\") format(\"svg\");\n font-weight: lighter;\n font-style: normal; }\n\n/*! normalize.css v3.0.2 | MIT License | git.io/normalize */\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n * user zoom.\n */\nhtml {\n font-family: sans-serif;\n /* 1 */\n -ms-text-size-adjust: 100%;\n /* 2 */\n -webkit-text-size-adjust: 100%;\n /* 2 */ }\n\n/**\n * Remove default margin.\n */\nbody {\n margin: 0; }\n\n/* HTML5 display definitions\n ========================================================================== */\n/**\n * Correct `block` display not defined for any HTML5 element in IE 8/9.\n * Correct `block` display not defined for `details` or `summary` in IE 10/11\n * and Firefox.\n * Correct `block` display not defined for `main` in IE 11.\n */\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n display: block; }\n\n/**\n * 1. Correct `inline-block` display not defined in IE 8/9.\n * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\n */\naudio,\ncanvas,\nprogress,\nvideo {\n display: inline-block;\n /* 1 */\n vertical-align: baseline;\n /* 2 */ }\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\naudio:not([controls]) {\n display: none;\n height: 0; }\n\n/**\n * Address `[hidden]` styling not present in IE 8/9/10.\n * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.\n */\n[hidden],\ntemplate {\n display: none; }\n\n/* Links\n ========================================================================== */\n/**\n * Remove the gray background color from active links in IE 10.\n */\na {\n background-color: transparent; }\n\n/**\n * Improve readability when focused and also mouse hovered in all browsers.\n */\na:active,\na:hover {\n outline: 0; }\n\n/* Text-level semantics\n ========================================================================== */\n/**\n * Address styling not present in IE 8/9/10/11, Safari, and Chrome.\n */\nabbr[title] {\n border-bottom: 1px dotted; }\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.\n */\nb,\nstrong {\n font-weight: bold; }\n\n/**\n * Address styling not present in Safari and Chrome.\n */\ndfn {\n font-style: italic; }\n\n/**\n * Address variable `h1` font-size and margin within `section` and `article`\n * contexts in Firefox 4+, Safari, and Chrome.\n */\nh1 {\n font-size: 2em;\n margin: 0.67em 0; }\n\n/**\n * Address styling not present in IE 8/9.\n */\nmark {\n background: #ff0;\n color: #000; }\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\nsmall {\n font-size: 80%; }\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline; }\n\nsup {\n top: -0.5em; }\n\nsub {\n bottom: -0.25em; }\n\n/* Embedded content\n ========================================================================== */\n/**\n * Remove border when inside `a` element in IE 8/9/10.\n */\nimg {\n border: 0; }\n\n/**\n * Correct overflow not hidden in IE 9/10/11.\n */\nsvg:not(:root) {\n overflow: hidden; }\n\n/* Grouping content\n ========================================================================== */\n/**\n * Address margin not present in IE 8/9 and Safari.\n */\nfigure {\n margin: 1em 40px; }\n\n/**\n * Address differences between Firefox and other browsers.\n */\nhr {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n height: 0; }\n\n/**\n * Contain overflow in all browsers.\n */\npre {\n overflow: auto; }\n\n/**\n * Address odd `em`-unit font size rendering in all browsers.\n */\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em; }\n\n/* Forms\n ========================================================================== */\n/**\n * Known limitation: by default, Chrome and Safari on OS X allow very limited\n * styling of `select`, unless a `border` property is set.\n */\n/**\n * 1. Correct color not being inherited.\n * Known issue: affects color of disabled elements.\n * 2. Correct font properties not being inherited.\n * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.\n */\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n color: inherit;\n /* 1 */\n font: inherit;\n /* 2 */\n margin: 0;\n /* 3 */ }\n\n/**\n * Address `overflow` set to `hidden` in IE 8/9/10/11.\n */\nbutton {\n overflow: visible; }\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.\n * Correct `select` style inheritance in Firefox.\n */\nbutton,\nselect {\n text-transform: none; }\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n * and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n * `input` and others.\n */\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n -webkit-appearance: button;\n /* 2 */\n cursor: pointer;\n /* 3 */ }\n\n/**\n * Re-set default cursor for disabled elements.\n */\nbutton[disabled],\nhtml input[disabled] {\n cursor: default; }\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n border: 0;\n padding: 0; }\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\ninput {\n line-height: normal; }\n\n/**\n * It's recommended that you don't attempt to style these elements.\n * Firefox's implementation doesn't respect box-sizing, padding, or width.\n *\n * 1. Address box sizing set to `content-box` in IE 8/9/10.\n * 2. Remove excess padding in IE 8/9/10.\n */\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n box-sizing: border-box;\n /* 1 */\n padding: 0;\n /* 2 */ }\n\n/**\n * Fix the cursor style for Chrome's increment/decrement buttons. For certain\n * `font-size` values of the `input`, it causes the cursor style of the\n * decrement button to change from `default` to `text`.\n */\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n height: auto; }\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari and Chrome\n * (include `-moz` to future-proof).\n */\ninput[type=\"search\"] {\n -webkit-appearance: textfield;\n /* 1 */\n -moz-box-sizing: content-box;\n -webkit-box-sizing: content-box;\n /* 2 */\n box-sizing: content-box; }\n\n/**\n * Remove inner padding and search cancel button in Safari and Chrome on OS X.\n * Safari (but not Chrome) clips the cancel button when the search input has\n * padding (and `textfield` appearance).\n */\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none; }\n\n/**\n * Define consistent border, margin, and padding.\n */\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em; }\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9/10/11.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\nlegend {\n border: 0;\n /* 1 */\n padding: 0;\n /* 2 */ }\n\n/**\n * Remove default vertical scrollbar in IE 8/9/10/11.\n */\ntextarea {\n overflow: auto; }\n\n/**\n * Don't inherit the `font-weight` (applied by a rule above).\n * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\n */\noptgroup {\n font-weight: bold; }\n\n/* Tables\n ========================================================================== */\n/**\n * Remove most spacing between table cells.\n */\ntable {\n border-collapse: collapse;\n border-spacing: 0; }\n\ntd,\nth {\n padding: 0; }\n\nhtml {\n font-size: 18px;\n box-sizing: border-box; }\n\nbody {\n padding: 0;\n margin: 0;\n font-family: \"Source Sans Pro\", \"Helvetica Neue\", Arial, sans-serif;\n font-weight: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1.8;\n color: #34495e;\n background: #fefefe;\n scroll-behavior: smooth; }\n\n@media screen and (max-width: 1080px) {\n body {\n border-top: 0; } }\n\n::selection {\n background: #c05b4d;\n color: #fff; }\n\nimg {\n max-width: 100%;\n height: auto;\n display: inline-block;\n vertical-align: middle; }\n\na {\n color: #34495e;\n text-decoration: none; }\n\nh1 {\n font-size: 1.6em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh2 {\n font-size: 1.5em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh3 {\n font-size: 1.3em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh4 {\n font-size: 1.2em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh5 {\n font-size: 1.1em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\nh6 {\n font-size: 1em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n\n.container {\n margin: 0 auto;\n width: 1080px; }\n\n@media screen and (max-width: 1080px) {\n .container {\n width: 100%; } }\n\n.content-wrapper {\n padding: 3em 0 1px 0; }\n\n.video-container {\n position: relative;\n padding-bottom: 56.25%;\n /* 16:9 */\n padding-top: 25px;\n height: 0; }\n\n.video-container iframe {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%; }\n\n.bg-llight {\n background-color: #f2f2f5; }\n\n.bg-white {\n background-color: #FFF; }\n\n@font-face {\n font-family: 'iconfont';\n /* project id 96542 */\n src: url(\"../fonts/iconfont/iconfont.eot\");\n src: url(\"../fonts/iconfont/iconfont.eot#iefix\") format(\"embedded-opentype\"), url(\"../fonts/iconfont/iconfont.woff\") format(\"woff\"), url(\"../fonts/iconfont/iconfont.ttf\") format(\"truetype\"), url(\"../fonts/iconfont/iconfont.svg#iconfont\") format(\"svg\"); }\n\n.iconfont {\n font-family: \"iconfont\" !important;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -webkit-text-stroke-width: 0.2px;\n -moz-osx-font-smoothing: grayscale;\n cursor: pointer; }\n\n.icon-instagram:before {\n font-size: .95em;\n content: \"\\e611\";\n position: relative;\n top: -1px; }\n\n.icon-douban:before {\n content: \"\\e610\"; }\n\n.icon-tumblr:before {\n content: \"\\e69f\";\n font-size: .85em;\n position: relative;\n top: -4px; }\n\n.icon-linkedin:before {\n content: \"\\e60d\";\n position: relative;\n top: -4px; }\n\n.icon-twitter:before {\n content: \"\\e600\"; }\n\n.icon-weibo:before {\n content: \"\\e602\"; }\n\n.icon-stack-overflow:before {\n content: \"\\e603\";\n font-size: .85em;\n position: relative;\n top: -4px; }\n\n.icon-email:before {\n content: \"\\e605\";\n position: relative;\n top: -2px; }\n\n.icon-facebook:before {\n content: \"\\e601\";\n font-size: .95em;\n position: relative;\n top: -2px; }\n\n.icon-github:before {\n content: \"\\e606\";\n position: relative;\n top: -3px; }\n\n.icon-rss:before {\n content: \"\\e604\"; }\n\n.icon-google:before {\n content: \"\\e609\"; }\n\n.icon-zhihu:before {\n content: \"\\e607\";\n font-size: .9em;\n position: relative;\n top: -2px; }\n\n.icon-pocket:before {\n content: \"\\e856\"; }\n\n/* Generic Icon */\n.icon-heart:before {\n content: \"\\e608\"; }\n\n.icon-right:before {\n content: \"\\e60a\"; }\n\n.icon-left:before {\n content: \"\\e60b\"; }\n\n.icon-up:before {\n content: \"\\e60c\"; }\n\n.icon-close:before {\n content: \"\\e60f\"; }\n\n.header:before, .header:after {\n content: \" \";\n display: table; }\n\n.header:after {\n clear: both; }\n\n.header .logo-wrapper {\n float: left;\n padding-left: 15px; }\n .header .logo-wrapper .logo {\n font-size: 36px;\n font-family: \"Chancery\", cursive, LiSu, sans-serif; }\n\n@media screen and (max-width: 1080px) {\n .header .logo-wrapper {\n display: none; } }\n\n.header .site-navbar .menu {\n float: right;\n padding-right: 15px;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .header .site-navbar .menu .menu-item {\n display: inline-block;\n margin-left: 1em;\n margin-right: 1em;\n display: inline-block;\n vertical-align: middle;\n transform: translateZ(0);\n backface-visibility: hidden;\n box-shadow: 0 0 1px transparent;\n position: relative;\n overflow: hidden; }\n .header .site-navbar .menu .menu-item + .menu-item {\n margin-left: 10px; }\n .header .site-navbar .menu .menu-item:before {\n content: '';\n position: absolute;\n z-index: -1;\n height: 2px;\n bottom: 0;\n left: 51%;\n right: 51%;\n background: #c05b4d;\n transition-duration: 0.2s;\n transition-property: right, left;\n transition-timing-function: ease-out; }\n .header .site-navbar .menu .menu-item.active:before, .header .site-navbar .menu .menu-item:active:before, .header .site-navbar .menu .menu-item:focus:before, .header .site-navbar .menu .menu-item:hover:before {\n right: 0;\n left: 0; }\n .header .site-navbar .menu .menu-item-link {\n font-size: 18px; }\n\n@media screen and (max-width: 1080px) {\n .header .site-navbar {\n display: none; } }\n\n@media screen and (max-width: 1080px) {\n .header {\n padding: 50px 0 0;\n text-align: center; } }\n\n.post {\n padding: 3em 5em;\n margin: 0 5em 3em; }\n .post .post-header {\n margin-bottom: 20px;\n text-align: center;\n padding-bottom: 10px;\n border-bottom: 2px LightGrey solid; }\n .post .post-header .post-title {\n margin: 0;\n font-size: 1.8em;\n font-weight: 400;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-header .post-link {\n display: inline-block;\n vertical-align: middle;\n transform: translateZ(0);\n backface-visibility: hidden;\n box-shadow: 0 0 1px transparent;\n position: relative;\n overflow: hidden; }\n .post .post-header .post-link:before {\n content: '';\n position: absolute;\n z-index: -1;\n height: 2px;\n bottom: 0;\n left: 51%;\n right: 51%;\n background: #c05b4d;\n transition-duration: 0.2s;\n transition-property: right, left;\n transition-timing-function: ease-out; }\n .post .post-header .post-link.active:before, .post .post-header .post-link:active:before, .post .post-header .post-link:focus:before, .post .post-header .post-link:hover:before {\n right: 0;\n left: 0; }\n .post .post-header .post-meta {\n font-size: 14px;\n color: #8a8a8a; }\n .post .post-header .post-meta .post-time {\n font-size: 15px; }\n .post .post-header .post-meta .post-category {\n display: inline; }\n .post .post-header .post-meta .post-category a {\n color: inherit; }\n .post .post-header .post-meta .post-category a::before {\n content: '·'; }\n .post .post-header .post-meta .post-category a:hover {\n color: #c05b4d; }\n .post .post-header .post-meta .more-meta::before {\n content: '·'; }\n .post .post-toc {\n padding: 10px;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif;\n border-bottom: 2px LightGrey solid;\n word-wrap: break-word; }\n .post .post-toc .post-toc-title {\n margin: 0 10px;\n font-size: 20px;\n font-weight: 400;\n text-transform: uppercase; }\n .post .post-toc .post-toc-content {\n font-size: 15px; }\n .post .post-toc .post-toc-content.always-active ul {\n display: block; }\n .post .post-toc .post-toc-content > nav > ul {\n margin: 10px 0; }\n .post .post-toc .post-toc-content ul {\n padding-left: 20px;\n list-style: square; }\n .post .post-toc .post-toc-content ul li > a {\n color: #139; }\n .post .post-toc .post-toc-content ul li > a:hover {\n color: #900; }\n .post .post-toc .post-toc-content ul ul {\n list-style: circle; }\n .post .post-toc .post-toc-content .toc-link.active {\n color: #c05b4d; }\n .post .post-content {\n word-wrap: break-word; }\n .post .post-content h1 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h2 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h3 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h4 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h5 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h6 {\n font-weight: 600;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content h1 {\n border-bottom: 1px solid #ddd;\n margin-top: 2em; }\n .post .post-content h2 {\n border-bottom: 1px solid #ddd;\n margin-top: 2em; }\n .post .post-content h3 {\n margin-top: 1.5em; }\n .post .post-content a {\n color: #c05b4d;\n word-break: break-all; }\n .post .post-content a:hover {\n border-bottom: 1px solid #c05b4d; }\n .post .post-content a.fancybox {\n border: 0; }\n .post .post-content blockquote {\n margin: 1em 0;\n padding: 1px 20px;\n position: relative;\n color: rgba(52, 73, 94, 0.8);\n background-color: rgba(192, 91, 77, 0.05);\n border-left: 3px solid rgba(192, 91, 77, 0.3);\n box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.125); }\n .post .post-content blockquote p {\n margin: 0.5em 0; }\n .post .post-content blockquote footer {\n margin: 0.5em 0; }\n .post .post-content blockquote cite:before {\n content: '\\2014';\n padding-right: .3em;\n padding-left: .3em;\n color: #aaa; }\n .post .post-content img {\n display: inline-block;\n max-width: 100%; }\n .post .post-content > table {\n max-width: 100%;\n margin: 10px 0;\n border-spacing: 0;\n box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.125); }\n .post .post-content > table thead {\n background: #f8f5ec; }\n .post .post-content > table th, .post .post-content > table td {\n padding: 5px 15px;\n border: 1px double #f4efe1; }\n .post .post-content > table tr:hover {\n background-color: #f8f5ec; }\n .post .post-content code, .post .post-content pre {\n padding: 7px;\n font-size: 13px;\n font-family: Consolas, Monaco, Menlo, Consolas, monospace;\n background: #f8f5ec; }\n .post .post-content code {\n padding: 3px 5px;\n border-radius: 4px;\n color: #c7254e; }\n .post .post-content .highlight {\n margin: 1em 0;\n border-radius: 5px;\n overflow-x: auto;\n box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.125);\n position: relative; }\n .post .post-content .highlight table {\n position: relative; }\n .post .post-content .highlight table::after {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n padding: 2px 7px;\n font-size: 13px;\n font-weight: bold;\n color: #b1b1b1;\n background: #f4efe1;\n content: 'Code'; }\n .post .post-content .highlight.language-bash > table::after {\n content: \"Bash\"; }\n .post .post-content .highlight.language-c > table::after {\n content: \"C\"; }\n .post .post-content .highlight.language-cs > table::after {\n content: \"C#\"; }\n .post .post-content .highlight.language-cpp > table::after {\n content: \"C++\"; }\n .post .post-content .highlight.language-css > table::after {\n content: \"CSS\"; }\n .post .post-content .highlight.language-coffeescript > table::after {\n content: \"CoffeeScript\"; }\n .post .post-content .highlight.language-html > table::after {\n content: \"HTML\"; }\n .post .post-content .highlight.language-xml > table::after {\n content: \"XML\"; }\n .post .post-content .highlight.language-http > table::after {\n content: \"HTTP\"; }\n .post .post-content .highlight.language-json > table::after {\n content: \"JSON\"; }\n .post .post-content .highlight.language-java > table::after {\n content: \"Java\"; }\n .post .post-content .highlight.language-js > table::after {\n content: \"JavaScript\"; }\n .post .post-content .highlight.language-javascript > table::after {\n content: \"JavaScript\"; }\n .post .post-content .highlight.language-makefile > table::after {\n content: \"Makefile\"; }\n .post .post-content .highlight.language-markdown > table::after {\n content: \"Markdown\"; }\n .post .post-content .highlight.language-objectivec > table::after {\n content: \"Objective-C\"; }\n .post .post-content .highlight.language-php > table::after {\n content: \"PHP\"; }\n .post .post-content .highlight.language-perl > table::after {\n content: \"Perl\"; }\n .post .post-content .highlight.language-python > table::after {\n content: \"Python\"; }\n .post .post-content .highlight.language-ruby > table::after {\n content: \"Ruby\"; }\n .post .post-content .highlight.language-sql > table::after {\n content: \"SQL\"; }\n .post .post-content .highlight.language-shell > table::after {\n content: \"Shell\"; }\n .post .post-content .highlight.language-erlang > table::after {\n content: \"Erlang\"; }\n .post .post-content .highlight.language-go > table::after {\n content: \"Go\"; }\n .post .post-content .highlight.language-groovy > table::after {\n content: \"Groovy\"; }\n .post .post-content .highlight.language-haskell > table::after {\n content: \"Haskell\"; }\n .post .post-content .highlight.language-kotlin > table::after {\n content: \"Kotlin\"; }\n .post .post-content .highlight.language-less > table::after {\n content: \"Less\"; }\n .post .post-content .highlight.language-lisp > table::after {\n content: \"Lisp\"; }\n .post .post-content .highlight.language-lua > table::after {\n content: \"Lua\"; }\n .post .post-content .highlight.language-matlab > table::after {\n content: \"Matlab\"; }\n .post .post-content .highlight.language-rust > table::after {\n content: \"Rust\"; }\n .post .post-content .highlight.language-scss > table::after {\n content: \"Scss\"; }\n .post .post-content .highlight.language-scala > table::after {\n content: \"Scala\"; }\n .post .post-content .highlight.language-swift > table::after {\n content: \"Swift\"; }\n .post .post-content .highlight.language-typescript > table::after {\n content: \"TypeScript\"; }\n .post .post-content .highlight.language-yml > table::after {\n content: \"YAML\"; }\n .post .post-content .highlight.language-yaml > table::after {\n content: \"YAML\"; }\n .post .post-content .highlight.language-toml > table::after {\n content: \"TOML\"; }\n .post .post-content .highlight .code pre {\n margin: 0;\n padding: 30px 10px 10px; }\n .post .post-content .highlight .gutter {\n width: 10px;\n color: #cacaca; }\n .post .post-content .highlight .gutter pre {\n margin: 0;\n padding: 30px 7px 10px; }\n .post .post-content .highlight .line {\n height: 20px; }\n .post .post-content .highlight table, .post .post-content .highlight tr, .post .post-content .highlight td {\n margin: 0;\n padding: 0;\n width: 100%;\n border-collapse: collapse; }\n .post .post-content .highlight .code .hljs-comment,\n .post .post-content .highlight .code .hljs-quote {\n color: #93a1a1; }\n .post .post-content .highlight .code .hljs-keyword,\n .post .post-content .highlight .code .hljs-selector-tag,\n .post .post-content .highlight .code .hljs-addition {\n color: #859900; }\n .post .post-content .highlight .code .hljs-number,\n .post .post-content .highlight .code .hljs-string,\n .post .post-content .highlight .code .hljs-meta .hljs-meta-string,\n .post .post-content .highlight .code .hljs-literal,\n .post .post-content .highlight .code .hljs-doctag,\n .post .post-content .highlight .code .hljs-regexp {\n color: #2aa198; }\n .post .post-content .highlight .code .hljs-title,\n .post .post-content .highlight .code .hljs-section,\n .post .post-content .highlight .code .hljs-name,\n .post .post-content .highlight .code .hljs-selector-id,\n .post .post-content .highlight .code .hljs-selector-class {\n color: #268bd2; }\n .post .post-content .highlight .code .hljs-attribute,\n .post .post-content .highlight .code .hljs-attr,\n .post .post-content .highlight .code .hljs-variable,\n .post .post-content .highlight .code .hljs-template-variable,\n .post .post-content .highlight .code .hljs-class .hljs-title,\n .post .post-content .highlight .code .hljs-type {\n color: #b58900; }\n .post .post-content .highlight .code .hljs-symbol,\n .post .post-content .highlight .code .hljs-bullet,\n .post .post-content .highlight .code .hljs-subst,\n .post .post-content .highlight .code .hljs-meta,\n .post .post-content .highlight .code .hljs-meta .hljs-keyword,\n .post .post-content .highlight .code .hljs-selector-attr,\n .post .post-content .highlight .code .hljs-selector-pseudo,\n .post .post-content .highlight .code .hljs-link {\n color: #cb4b16; }\n .post .post-content .highlight .code .hljs-built_in,\n .post .post-content .highlight .code .hljs-deletion {\n color: #dc322f; }\n .post .post-content .highlight .code .hljs-formula {\n background: #eee8d5; }\n .post .post-content .highlight .code .hljs-emphasis {\n font-style: italic; }\n .post .post-content .highlight .code .hljs-strong {\n font-weight: bold; }\n .post .post-content .post-summary {\n margin-bottom: 1em; }\n .post .post-content .read-more {\n text-align: right; }\n .post .post-content .read-more .read-more-link {\n color: #c05b4d;\n font-size: 1.1em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-content .read-more .read-more-link:hover {\n border-bottom: 1px solid #c05b4d; }\n .post .post-content kbd {\n display: inline-block;\n padding: 0.25em;\n background-color: #fafafa;\n border: 1px solid #dbdbdb;\n border-bottom-color: #b5b5b5;\n border-radius: 3px;\n box-shadow: inset 0 -1px 0 #b5b5b5;\n font-size: 0.8em;\n line-height: 1.25;\n font-family: \"SFMono-Regular\",\"Liberation Mono\",\"Roboto Mono\",Menlo,Monaco,Consolas,\"Courier New\",Courier,monospace;\n color: #4a4a4a; }\n .post .post-content dl dt::after {\n content: ':'; }\n .post .post-content figure.center {\n text-align: center; }\n .post .post-content figure figcaption h4 {\n color: #b5b5b5;\n font-size: 0.9rem; }\n .post .post-content .task-list {\n list-style: none;\n padding-left: 1.5rem; }\n .post .post-copyright {\n margin-top: 20px;\n padding-top: 10px;\n border-top: 1px dashed #e6e6e6; }\n .post .post-copyright .copyright-item {\n margin: 5px 0; }\n .post .post-copyright .copyright-item a {\n color: #c05b4d;\n word-wrap: break-word; }\n .post .post-copyright .copyright-item a:hover {\n border-bottom: 1px solid #c05b4d; }\n .post .post-copyright .copyright-item .item-title {\n display: inline-block;\n min-width: 5rem;\n margin-right: .5rem;\n text-align: right; }\n .post .post-copyright .copyright-item .item-title:after {\n content: \" :\"; }\n .post .post-reward {\n margin-top: 20px;\n padding-top: 10px;\n text-align: center;\n border-top: 1px dashed #e6e6e6; }\n .post .post-reward .reward-button {\n margin: 15px 0;\n padding: 3px 7px;\n display: inline-block;\n color: #c05b4d;\n border: 1px solid #c05b4d;\n border-radius: 5px;\n cursor: pointer; }\n .post .post-reward .reward-button:hover {\n color: #fefefe;\n background-color: #c05b4d;\n transition: 0.5s; }\n .post .post-reward #reward:checked ~ .qr-code {\n display: block; }\n .post .post-reward #reward:checked ~ .reward-button {\n display: none; }\n .post .post-reward .qr-code {\n display: none; }\n .post .post-reward .qr-code .qr-code-image {\n display: inline-block;\n min-width: 200px;\n width: 40%;\n margin-top: 15px; }\n .post .post-reward .qr-code .qr-code-image span {\n display: inline-block;\n width: 100%;\n margin: 8px 0; }\n .post .post-reward .qr-code .image {\n width: 200px;\n height: 200px; }\n .post .post-footer {\n margin-top: 20px;\n margin-bottom: 40px;\n border-top: 1px solid #e6e6e6;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .post .post-footer .post-tags {\n padding: 15px 0; }\n .post .post-footer .post-tags a {\n margin-right: 5px;\n color: #c05b4d;\n word-break: break-all; }\n .post .post-footer .post-tags a::before {\n content: '#'; }\n .post .post-footer .post-nav {\n margin: 1em 0; }\n .post .post-footer .post-nav:before, .post .post-footer .post-nav:after {\n content: \" \";\n display: table; }\n .post .post-footer .post-nav:after {\n clear: both; }\n .post .post-footer .post-nav .prev,\n .post .post-footer .post-nav .next {\n font-weight: 600;\n font-size: 18px;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s; }\n .post .post-footer .post-nav .prev {\n float: left; }\n .post .post-footer .post-nav .prev:hover {\n color: #c05b4d;\n transform: translateX(-4px); }\n .post .post-footer .post-nav .next {\n float: right; }\n .post .post-footer .post-nav .next:hover {\n color: #c05b4d;\n transform: translateX(4px); }\n .post .post-footer .post-nav .nav-mobile {\n display: none; }\n @media screen and (max-width: 1080px) {\n .post .post-footer .post-nav .nav-default {\n display: none; }\n .post .post-footer .post-nav .nav-mobile {\n display: inline; } }\n .post .disqus-button {\n display: block;\n padding: 15px 0;\n font-size: 16px;\n color: #555;\n border: 1px solid #ddd;\n text-align: center;\n cursor: pointer; }\n\n@media screen and (max-width: 504px) {\n .post {\n padding: 1em 1em;\n margin: 0 0 2em; }\n .content-wrapper {\n padding: 1em 0 1px; } }\n\n@media screen and (min-width: 900px) and (max-width: 1080px) {\n .post {\n margin: 0 2em 2em; }\n .content-wrapper {\n padding: 2em 0 1px; } }\n\n@media screen and (min-width: 504px) and (max-width: 899px) {\n .post {\n padding: 1em 1em;\n margin: 0 1em 2em; }\n .content-wrapper {\n padding: 1em 0 1px; } }\n\n.pagination {\n margin: 2em 0;\n text-align: center; }\n .pagination:before, .pagination:after {\n content: \" \";\n display: table; }\n .pagination:after {\n clear: both; }\n .pagination li {\n display: inline-block; }\n .pagination li a {\n background-color: #fff;\n margin-left: .1em;\n margin-right: .1em;\n border: 1px solid #222;\n color: #222;\n float: left;\n line-height: 1.42857143;\n padding: 6px 12px;\n position: relative;\n text-decoration: none;\n margin-bottom: 0.2em; }\n .pagination .active a {\n background-color: #222;\n border-color: #222;\n color: #fff;\n cursor: default;\n z-index: 2; }\n\n@media screen and (max-width: 1080px) {\n .pagination {\n margin: 1em 0; } }\n\n.footer {\n margin-top: 2em; }\n .footer .social-links {\n text-align: center; }\n .footer .social-links .iconfont {\n font-size: 30px; }\n .footer .social-links .iconfont + .iconfont {\n margin-left: 10px; }\n .footer .social-links .iconfont:hover {\n color: #c05b4d; }\n .footer .copyright {\n margin: 10px 0;\n color: #8a8a8a;\n text-align: center;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .footer .copyright .hexo-link,\n .footer .copyright .theme-link {\n color: #c05b4d; }\n .footer .copyright .copyright-year {\n display: block; }\n .footer .copyright .copyright-year .heart {\n font-size: 14px; }\n\n.archive {\n margin: 0 5em 3em;\n background-color: white;\n padding: 1em 5em 5em 5em; }\n .archive .archive-title {\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .archive .archive-title.tag, .archive .archive-title.category {\n margin: 20px 0; }\n .archive .archive-title .archive-name {\n margin: 0;\n display: inline-block;\n font-weight: 400;\n font-size: 30px;\n line-height: 32px; }\n .archive .archive-title .archive-post-counter {\n display: none;\n color: #8a8a8a; }\n .archive .collection-title {\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .archive .collection-title .archive-year {\n margin: 2em 0 0;\n font-weight: 400;\n font-size: 28px;\n line-height: 30px; }\n .archive .archive-post {\n padding: 15px 20px 5px 20px;\n border-bottom: 1px solid #cacaca;\n font-size: 1.1em; }\n .archive .archive-post .archive-post-time {\n margin-right: 50px;\n color: #8a8a8a; }\n .archive .archive-post .archive-post-title .archive-post-link {\n color: #c05b4d; }\n .archive .archive-post::first-child {\n margin-top: 10px; }\n .archive .archive-post:hover {\n transition: 0.2s ease-out;\n transform: translateX(4px); }\n .archive .archive-post:hover .archive-post-time {\n color: #717171; }\n .archive .archive-post:hover .archive-post-title .archive-post-link {\n color: #a14639; }\n .archive .more-post {\n text-align: right; }\n .archive .more-post .more-post-link {\n margin-top: 1em;\n color: #c05b4d;\n font-size: 1.1em;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .archive .more-post .more-post-link:hover {\n border-bottom: 1px solid #c05b4d; }\n\n@media screen and (max-width: 899px) {\n .archive {\n margin: 0 auto 1em auto;\n padding: 1em; }\n .archive .archive-title .archive-name {\n font-size: 26px; }\n .archive .collection-title .archive-year {\n margin: 10px 0;\n font-size: 24px; }\n .archive .archive-post {\n padding: 5px 10px; }\n .archive .archive-post .archive-post-time {\n font-size: 13px;\n display: block; } }\n\n.tag-cloud {\n margin: 2em 0 3em;\n text-align: center;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .tag-cloud .tag-cloud-title {\n display: inline-block;\n font-size: 24px;\n color: #c05b4d;\n border-bottom: 2px solid #c05b4d; }\n .tag-cloud .tag-cloud-tags {\n margin: 10px 0; }\n .tag-cloud .tag-cloud-tags a {\n display: inline-block;\n position: relative;\n margin: 5px 10px;\n word-wrap: break-word;\n transition-duration: 0.2s;\n transition-property: transform;\n transition-timing-function: ease-out; }\n .tag-cloud .tag-cloud-tags a .tag-count {\n display: inline-block;\n position: relative;\n top: -8px;\n right: -2px;\n color: #c05b4d;\n font-size: 12px; }\n .tag-cloud .tag-cloud-tags a:active, .tag-cloud .tag-cloud-tags a:focus, .tag-cloud .tag-cloud-tags a:hover {\n color: #c05b4d;\n transform: scale(1.1); }\n\n.categories {\n margin: 2em 0 3em;\n text-align: center;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .categories .categories-title {\n display: inline-block;\n font-size: 18px;\n color: #c05b4d;\n border-bottom: 2px solid #c05b4d; }\n .categories .categories-tags {\n margin: 10px 0; }\n .categories .categories-tags .category-link {\n display: inline-block;\n position: relative;\n margin: 5px 10px;\n word-wrap: break-word;\n transition-duration: 0.2s;\n transition-property: transform;\n transition-timing-function: ease-out; }\n .categories .categories-tags .category-link .category-count {\n display: inline-block;\n position: relative;\n top: -8px;\n right: -2px;\n color: #c05b4d;\n font-size: 12px; }\n .categories .categories-tags .category-link:active, .categories .categories-tags .category-link:focus, .categories .categories-tags .category-link:hover {\n color: #c05b4d;\n transform: scale(1.1); }\n\n.slideout-menu {\n position: fixed;\n top: 0;\n left: 0px;\n bottom: 0;\n width: 180px;\n min-height: 100vh;\n overflow-y: hidden;\n -webkit-overflow-scrolling: touch;\n z-index: 0;\n display: none; }\n\n.slideout-panel {\n position: relative;\n z-index: 1;\n background-color: #fefefe;\n min-height: 100%; }\n\n.slideout-open,\n.slideout-open body,\n.slideout-open .slideout-panel {\n overflow: hidden; }\n\n.slideout-open .slideout-menu {\n display: block; }\n\n.mobile-navbar {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 50px;\n background: #fefefe;\n box-shadow: 0px 2px 2px #cacaca;\n text-align: center;\n transition: transform 300ms ease;\n z-index: 99; }\n .mobile-navbar.fixed-open {\n transform: translate3d(180px, 0px, 0px); }\n .mobile-navbar .mobile-header-logo {\n display: inline-block;\n margin-right: 50px; }\n .mobile-navbar .mobile-header-logo .logo {\n font-size: 22px;\n line-height: 50px;\n font-family: \"Chancery\", cursive, LiSu, sans-serif; }\n .mobile-navbar .mobile-navbar-icon {\n color: #c05b4d;\n height: 50px;\n width: 50px;\n font-size: 24px;\n text-align: center;\n float: left;\n position: relative;\n transition: background 0.5s; }\n\n@keyframes clickfirst {\n 0% {\n transform: translateY(6px) rotate(0deg); }\n 100% {\n transform: translateY(0) rotate(45deg); } }\n\n@keyframes clickmid {\n 0% {\n opacity: 1; }\n 100% {\n opacity: 0; } }\n\n@keyframes clicklast {\n 0% {\n transform: translateY(-6px) rotate(0deg); }\n 100% {\n transform: translateY(0) rotate(-45deg); } }\n\n@keyframes outfirst {\n 0% {\n transform: translateY(0) rotate(-45deg); }\n 100% {\n transform: translateY(-6px) rotate(0deg); } }\n\n@keyframes outmid {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@keyframes outlast {\n 0% {\n transform: translateY(0) rotate(45deg); }\n 100% {\n transform: translateY(6px) rotate(0deg); } }\n .mobile-navbar .mobile-navbar-icon span {\n position: absolute;\n /* fallback for browsers which still doesn't support for `calc()` */\n left: 15px;\n top: 25px;\n left: calc((100% - 20px) / 2);\n top: calc((100% - 1px) / 2);\n width: 20px;\n height: 1px;\n background-color: #c05b4d; }\n .mobile-navbar .mobile-navbar-icon span:nth-child(1) {\n transform: translateY(6px) rotate(0deg); }\n .mobile-navbar .mobile-navbar-icon span:nth-child(3) {\n transform: translateY(-6px) rotate(0deg); }\n .mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(1) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: clickfirst; }\n .mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(2) {\n animation-duration: 0.2s;\n animation-fill-mode: both;\n animation-name: clickmid; }\n .mobile-navbar .mobile-navbar-icon.icon-click span:nth-child(3) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: clicklast; }\n .mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(1) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: outfirst; }\n .mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(2) {\n animation-duration: 0.2s;\n animation-fill-mode: both;\n animation-name: outmid; }\n .mobile-navbar .mobile-navbar-icon.icon-out span:nth-child(3) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: outlast; }\n\n.mobile-menu {\n background-color: rgba(248, 245, 236, 0.5); }\n .mobile-menu .mobile-menu-list {\n position: relative;\n list-style: none;\n margin-top: 50px;\n padding: 0;\n border-top: 1px solid #f8f5ec; }\n .mobile-menu .mobile-menu-list .mobile-menu-item {\n padding: 10px 30px;\n border-bottom: 1px solid #f8f5ec; }\n .mobile-menu .mobile-menu-list a {\n font-size: 18px;\n font-family: Athelas, STHeiti, Microsoft Yahei, serif; }\n .mobile-menu .mobile-menu-list a:hover {\n color: #c05b4d; }\n\n@media screen and (max-width: 1080px) {\n .mobile-navbar {\n display: block; } }\n\n.back-to-top {\n display: none;\n position: fixed;\n right: 20px;\n bottom: 20px;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s;\n z-index: 10; }\n .back-to-top:hover {\n transform: translateY(-5px); }\n\n@media screen and (max-width: 1080px) {\n .back-to-top {\n display: none !important; } }\n\n.not-found {\n text-align: center; }\n .not-found .error-emoji {\n color: #363636;\n font-size: 3rem; }\n .not-found .error-text {\n color: #797979;\n font-size: 1.25rem; }\n .not-found .error-link {\n margin-top: 2rem; }\n .not-found .error-link a {\n color: #c05b4d; }\n\n\n\n// WEBPACK FOOTER //\n// ./css/style.scss","@import '_common/normalize';\n\nhtml {\n font-size: $global-font-size;\n box-sizing: border-box;\n}\n\nbody {\n padding: 0;\n margin: 0;\n font-family: $global-font-family;\n font-weight: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: $global-lineheight;\n color: $global-font-color;\n background: $global-background;\n scroll-behavior: smooth;\n // border-top: 3px solid $theme-color;\n}\n\n@include max-screen() {\n body {\n border-top: 0;\n }\n}\n\n::selection {\n background: $theme-color;\n color: #fff; \n}\n\n// ::-webkit-scrollbar {\n// width: 8px;\n// height: 6px; \n// }\n\n// ::-webkit-scrollbar-thumb {\n// background: lighten($theme-color, 10%);\n// border-radius: 5px;\n// }\n\n// ::-webkit-scrollbar-track {\n// background: rgba(211, 211, 211, 0.4);\n// border-radius: 5px;\n// }\n\nimg {\n max-width: 100%;\n height: auto;\n display: inline-block;\n vertical-align: middle;\n}\n\na {\n color: $global-font-color;\n text-decoration: none;\n}\n\n@each $header, $size in $global-headings {\n #{$header} {\n font-size: $size;\n font-family: $global-serif-font-family;\n }\n}\n\n.container {\n margin: 0 auto;\n width: $global-body-width;\n}\n\n@include max-screen() {\n .container {\n width: 100%;\n }\n}\n\n.content-wrapper {\n padding: 3em 0 1px 0;\n}\n\n// make video fluid:\n// https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php\n// class video-container is the wrapper used by hexo youtube tag plugin\n.video-container {\n\tposition: relative;\n\tpadding-bottom: 56.25%; /* 16:9 */\n\tpadding-top: 25px;\n\theight: 0;\n}\n.video-container iframe {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n\n.bg-llight {\n background-color: #f2f2f5;\n}\n\n.bg-white {\n background-color: #FFF;\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_base.scss","@mixin clearfix() {\n &:before,\n &:after {\n content: \" \";\n display: table;\n }\n \n &:after {\n clear: both;\n }\n}\n\n@mixin min-screen($min-width: $global-body-width) {\n @media screen and (min-width: $min-width) {\n @content;\n }\n}\n\n@mixin max-screen($max-width: $global-body-width) {\n @media screen and (max-width: $max-width) {\n @content;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_common/_utils.scss","// ==============================\n// Iconfont\n// ==============================\n\n@font-face {\n font-family: 'iconfont'; /* project id 96542 */\n\n src: url('../fonts/iconfont/iconfont.eot');\n src: url('../fonts/iconfont/iconfont.eot#iefix') format('embedded-opentype'), // not '?#iefix', because webpack will add '?hash=[hash]'\n url('../fonts/iconfont/iconfont.woff') format('woff'),\n url('../fonts/iconfont/iconfont.ttf') format('truetype'),\n url('../fonts/iconfont/iconfont.svg#iconfont') format('svg');\n\n // Uncomment these code and comment upper code if you want to use alicdn\n // src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot');\n // src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot?#iefix') format('embedded-opentype'),\n // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.woff') format('woff'),\n // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.ttf') format('truetype'),\n // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.svg#iconfont') format('svg');\n}\n\n.iconfont {\n font-family: \"iconfont\" !important;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -webkit-text-stroke-width: 0.2px;\n -moz-osx-font-smoothing: grayscale;\n cursor: pointer;\n}\n\n.icon-instagram:before {\n font-size: .95em;\n content: \"\\e611\";\n position: relative;\n top: -1px;\n}\n.icon-douban:before {\n content: \"\\e610\";\n}\n.icon-tumblr:before {\n content: \"\\e69f\";\n font-size: .85em;\n position: relative;\n top: -4px;\n}\n.icon-linkedin:before {\n content: \"\\e60d\";\n position: relative;\n top: -4px;\n}\n.icon-twitter:before {\n content: \"\\e600\";\n}\n.icon-weibo:before {\n content: \"\\e602\";\n}\n.icon-stack-overflow:before {\n content: \"\\e603\";\n font-size: .85em;\n position: relative;\n top: -4px;\n}\n.icon-email:before {\n content: \"\\e605\";\n position: relative;\n top: -2px;\n}\n.icon-facebook:before {\n content: \"\\e601\";\n font-size: .95em;\n position: relative;\n top: -2px;\n}\n.icon-github:before {\n content: \"\\e606\";\n position: relative;\n top: -3px;\n}\n.icon-rss:before {\n content: \"\\e604\";\n}\n.icon-google:before {\n content: \"\\e609\";\n}\n.icon-zhihu:before {\n content: \"\\e607\";\n font-size: .9em;\n position: relative;\n top: -2px;\n}\n.icon-pocket:before {\n content: \"\\e856\";\n}\n\n/* Generic Icon */\n.icon-heart:before {\n content: \"\\e608\";\n}\n.icon-right:before {\n content: \"\\e60a\";\n}\n.icon-left:before {\n content: \"\\e60b\";\n}\n.icon-up:before {\n content: \"\\e60c\";\n}\n.icon-close:before {\n content: \"\\e60f\";\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_iconfont.scss","// ==============================\n// Header\n// ==============================\n\n.header {\n @include clearfix; \n\n @import '_header/logo';\n @import '_header/menu';\n}\n\n\n@include max-screen() {\n .header {\n padding: 50px 0 0;\n text-align: center;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_header.scss","// ==============================\n// Logo\n// =============================\n\n.logo-wrapper {\n float: left;\n padding-left: 15px;\n\n .logo {\n font-size: $logo-font-size;\n font-family: $logo-font-family;\n }\n}\n\n@include max-screen() {\n .logo-wrapper {\n display: none;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_header/_logo.scss","// ==============================\n// Menu\n// =============================\n\n.site-navbar {\n .menu {\n float: right;\n padding-right: 15px;\n font-family: $global-serif-font-family;\n\n .menu-item {\n display: inline-block;\n margin-left: 1em;\n margin-right: 1em;\n\n & + .menu-item {\n margin-left: $menu-item-margin-left;;\n }\n\n @include underline-from-center;\n }\n\n .menu-item-link {\n font-size: $menu-link-font-size;\n }\n }\n}\n\n@include max-screen() {\n .site-navbar {\n display: none;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_header/_menu.scss","@mixin underline-from-center() {\n display: inline-block;\n vertical-align: middle;\n transform: translateZ(0);\n backface-visibility: hidden;\n box-shadow: 0 0 1px transparent;\n position: relative;\n overflow: hidden;\n\n &:before {\n content: '';\n position: absolute;\n z-index: -1;\n height: 2px;\n bottom: 0;\n left: 51%;\n right: 51%;\n background: $theme-color;\n transition-duration: 0.2s;\n transition-property: right, left;\n transition-timing-function: ease-out;\n }\n\n &.active,\n &:active,\n &:focus,\n &:hover {\n &:before {\n right: 0;\n left: 0;\n }\n }\n}\n\n@mixin mobile-menu-icon() {\n @keyframes clickfirst {\n 0% {\n transform: translateY(6px) rotate(0deg);\n \n }\n\n 100% {\n transform: translateY(0) rotate(45deg);\n }\n }\t\n\n @keyframes clickmid {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes clicklast {\n 0% {\n transform: translateY(-6px) rotate(0deg);\n }\n\n 100% {\n transform: translateY(0) rotate(-45deg);\n }\n }\n \n @keyframes outfirst {\n 0% {\n transform: translateY(0) rotate(-45deg);\n }\n\n 100% {\n transform: translateY(-6px) rotate(0deg);\n }\n }\t\n\n @keyframes outmid {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n @keyframes outlast {\n 0% {\n transform: translateY(0) rotate(45deg);\n }\n\n 100% {\n transform: translateY(6px) rotate(0deg);\n }\n }\n\n span {\n position: absolute;\n /* fallback for browsers which still doesn't support for `calc()` */\n left: 15px;\n top: 25px;\n left: calc((100% - 20px) / 2);\n top: calc((100% - 1px) / 2);\n width: 20px;\n height: 1px;\n background-color: $theme-color;\n \n &:nth-child(1) {\n transform: translateY(6px) rotate(0deg);\n }\n\n &:nth-child(3) {\n transform: translateY(-6px) rotate(0deg);\n }\n }\n\n &.icon-click {\n span:nth-child(1) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: clickfirst;\n }\n\n span:nth-child(2) {\n animation-duration: 0.2s;\n animation-fill-mode: both;\n animation-name: clickmid;\n }\n\n span:nth-child(3) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: clicklast;\n }\n }\n\n &.icon-out {\n span:nth-child(1) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: outfirst;\n }\n\n span:nth-child(2) {\n animation-duration: 0.2s;\n animation-fill-mode: both;\n animation-name: outmid;\n }\n\n span:nth-child(3) {\n animation-duration: 0.5s;\n animation-fill-mode: both;\n animation-name: outlast;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_common/_animation.scss","// ==============================\n// Post\n// ==============================\n\n.posts {\n // margin-bottom: $post-list-margin-bottom;\n// border-bottom: $post-border;\n}\n\n.post {\n padding: 3em 5em;\n margin: 0 5em 3em;\n \n // & + .post {\n // border-top: $post-border;\n // }\n\n @import '_post/header';\n @import '_post/toc';\n @import '_post/content';\n @import '_post/copyright';\n @import '_post/reward';\n @import '_post/footer';\n @import '_post/disqus';\n}\n\n@media screen and (max-width: 504px) {\n .post {\n padding: 1em 1em;\n margin: 0 0 2em;\n }\n\n .content-wrapper {\n padding: 1em 0 1px;\n }\n}\n\n@media screen and (min-width: 900px) and (max-width: 1080px) {\n .post {\n margin: 0 2em 2em;\n }\n\n .content-wrapper {\n padding: 2em 0 1px;\n }\n}\n\n@media screen and (min-width: 504px) and (max-width: 899px) {\n .post {\n padding: 1em 1em;\n margin: 0 1em 2em;\n }\n\n .content-wrapper {\n padding: 1em 0 1px;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post.scss",".post-header {\n margin-bottom: 20px;\n text-align: center;\n padding-bottom: 10px;\n border-bottom: 2px LightGrey solid;\n\n .post-title {\n margin: 0;\n font-size: $post-title-font-size;\n font-weight: $post-title-font-weight;\n font-family: $global-serif-font-family;\n }\n\n .post-link {\n @include underline-from-center;\n }\n\n .post-meta {\n font-size: 14px;\n color: $post-meta-font-color;\n\n .post-time {\n font-size: 15px;\n }\n\n .post-category {\n display: inline;\n\n a {\n color: inherit;\n\n &::before {\n content: '·';\n }\n\n &:hover {\n color: $theme-color;\n }\n }\n }\n\n .more-meta {\n &::before {\n content: '·';\n }\n }\n\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_header.scss",".post-toc {\n // position: absolute;\n // width: 15em;\n // margin-left: $post-toc-margin-left;\n padding: 10px;\n font-family: $global-serif-font-family;\n border-bottom: 2px LightGrey solid;\n // border-radius: 5px;\n // background: $post-toc-backgroud;\n // box-shadow: 1px 1px 2px rgba(0,0,0,0.125);\n word-wrap: break-word;\n // box-sizing: border-box;\n\n .post-toc-title {\n margin: 0 10px;\n font-size: $post-toc-title-size;\n font-weight: 400;\n text-transform: uppercase;\n }\n\n .post-toc-content {\n font-size: $post-toc-content;\n\n &.always-active ul {\n display: block;\n }\n\n >nav>ul {\n margin: 10px 0;\n }\n\n ul {\n padding-left: 20px;\n list-style: $post-toc-list-style;\n\n li > a {\n color: #139;\n }\n\n li > a:hover{\n color: #900;\n }\n\n ul {\n list-style: circle;\n }\n // ul {\n // padding-left: 15px;\n // display: none;\n // }\n\n // .has-active > ul {\n // display: block;\n // }\n }\n\n .toc-link.active {\n color: $theme-color;\n }\n }\n}\n\n// @include max-screen($toc-max-sreen-width) {\n// .post-toc {\n// display: none;\n// }\n// }\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_toc.scss","// ==============================\n// Post content\n// ==============================\n\n.post-content {\n word-wrap: break-word;\n\n @for $i from 1 through 6 {\n h#{$i} {\n font-weight: 600;\n font-family: $global-serif-font-family;\n }\n }\n\n h1 {\n border-bottom: 1px solid #ddd;\n margin-top: 2em;\n }\n\n h2 {\n // font-size: 1.6em;\n border-bottom: 1px solid #ddd;\n margin-top: 2em;\n }\n\n h3 {\n // font-size: 1.3em;\n margin-top: 1.5em;\n }\n\n a {\n color: $theme-color;\n word-break: break-all;\n\n &:hover {\n border-bottom: $content-link-border;\n }\n\n &.fancybox {\n border: 0;\n }\n }\n\n blockquote {\n margin: 1em 0;\n padding: 1px 20px;\n position: relative;\n color: rgba(#34495e, 0.8);\n background-color: $content-blockquote-backgroud;\n border-left: $content-blockquote-border-left;\n box-shadow: 1px 1px 2px rgba(0,0,0,0.125);\n\n p {\n margin: 0.5em 0;\n }\n\n footer {\n margin: 0.5em 0;\n }\n\n cite:before {\n content: '\\2014';\n padding-right: .3em;\n padding-left: .3em;\n color: #aaa;\n }\n }\n\n img {\n display: inline-block;\n max-width: 100%;\n }\n\n > table {\n max-width: 100%;\n margin: 10px 0;\n border-spacing: 0;\n box-shadow: 2px 2px 3px rgba(0,0,0,.125);\n\n thead {\n background: $deputy-color;\n }\n\n th, td {\n padding: 5px 15px;\n border: 1px double $content-table-border-color;\n }\n\n tr:hover {\n background-color: $deputy-color;\n }\n }\n\n @import 'code';\n\n .post-summary {\n margin-bottom: 1em;\n }\n\n .read-more {\n text-align: right;\n\n .read-more-link {\n color: $theme-color;\n font-size: 1.1em;\n font-family: $global-serif-font-family;\n \n &:hover {\n border-bottom: $post-readMore-border-bottom;\n }\n }\n }\n\n kbd {\n display: inline-block;\n padding: 0.25em;\n background-color: #fafafa;\n border: 1px solid #dbdbdb;\n border-bottom-color: #b5b5b5;\n border-radius: 3px;\n box-shadow: inset 0 -1px 0 #b5b5b5;\n font-size: 0.8em;\n line-height: 1.25;\n font-family: \"SFMono-Regular\",\"Liberation Mono\",\"Roboto Mono\",Menlo,Monaco,Consolas,\"Courier New\",Courier,monospace;\n color: #4a4a4a;\n }\n\n dl dt::after {\n content: ':';\n }\n\n figure {\n &.center {\n text-align: center;\n }\n\n figcaption h4 {\n color: #b5b5b5;\n font-size: 0.9rem;\n }\n }\n\n .task-list {\n list-style: none;\n padding-left: 1.5rem;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_content.scss","code, pre {\n padding: 7px;\n font-size: $code-font-size;\n font-family: $code-font-family;\n background: $code-background;\n}\n\ncode {\n padding: 3px 5px;\n border-radius: 4px;\n color: $code-color;\n}\n\n.highlight {\n margin: 1em 0;\n border-radius: 5px;\n overflow-x: auto;\n box-shadow: 1px 1px 2px rgba(0,0,0,0.125);\n position: relative;\n\n table {\n position: relative;\n\n &::after {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n padding: 2px 7px;\n font-size: $code-font-size;\n font-weight: bold;\n color: darken($gray, 10%);\n background: darken($code-background, 3%);\n content: 'Code';\n }\n }\n\n @each $sign, $text in $code-type-list {\n &.#{$sign} > table::after {\n content: $text;\n }\n }\n\n .code {\n pre {\n margin: 0;\n padding: 30px 10px 10px;\n }\n }\n\n .gutter {\n width: 10px;\n color: $gray;\n\n pre {\n margin: 0;\n padding: 30px 7px 10px;\n }\n }\n\n .line {\n // Fix code block null line height and\n // Synchronous gutter and code line highly.\n height: round($code-font-size * 1.5);\n }\n\n table, tr, td {\n margin: 0;\n padding: 0;\n width: 100%;\n border-collapse: collapse;\n }\n\n .code {\n .hljs-comment,\n .hljs-quote {\n color: map-get($code-highlight-color, comment);\n }\n\n .hljs-keyword,\n .hljs-selector-tag,\n .hljs-addition {\n color: map-get($code-highlight-color, keyword);\n }\n\n .hljs-number,\n .hljs-string,\n .hljs-meta .hljs-meta-string,\n .hljs-literal,\n .hljs-doctag,\n .hljs-regexp {\n color: map-get($code-highlight-color, number);\n }\n\n .hljs-title,\n .hljs-section,\n .hljs-name,\n .hljs-selector-id,\n .hljs-selector-class {\n color: map-get($code-highlight-color, title);\n }\n\n .hljs-attribute,\n .hljs-attr,\n .hljs-variable,\n .hljs-template-variable,\n .hljs-class .hljs-title,\n .hljs-type {\n color: map-get($code-highlight-color, attribute);\n }\n\n .hljs-symbol,\n .hljs-bullet,\n .hljs-subst,\n .hljs-meta,\n .hljs-meta .hljs-keyword,\n .hljs-selector-attr,\n .hljs-selector-pseudo,\n .hljs-link {\n color: map-get($code-highlight-color, symbol);\n }\n\n .hljs-built_in,\n .hljs-deletion {\n color: map-get($code-highlight-color, built_in);\n }\n\n .hljs-formula {\n background: map-get($code-highlight-color, formula);\n }\n \n .hljs-emphasis {\n font-style: italic;\n }\n \n .hljs-strong {\n font-weight: bold;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_code.scss",".post-copyright {\n margin-top: 20px;\n padding-top: 10px;\n border-top: 1px dashed $light-gray;\n\n .copyright-item {\n margin: 5px 0;\n\n a {\n color: $theme-color;\n word-wrap: break-word;\n\n &:hover {\n border-bottom: $content-link-border;\n }\n }\n\n .item-title {\n display: inline-block;\n min-width: 5rem;\n margin-right: .5rem;\n text-align: right;\n\n &:after {\n content: \" :\";\n }\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_copyright.scss",".post-reward {\n margin-top: 20px;\n padding-top: 10px;\n text-align: center;\n border-top: 1px dashed $light-gray;\n\n .reward-button {\n margin: 15px 0;\n padding: 3px 7px;\n display: inline-block;\n color: $theme-color;\n border: 1px solid $theme-color;\n border-radius: 5px;\n cursor: pointer;\n\n &:hover {\n color: $white;\n background-color: $theme-color;\n transition: 0.5s;\n }\n }\n\n #reward:checked {\n & ~ .qr-code {\n display: block;\n }\n\n & ~ .reward-button {\n display: none;\n }\n }\n\n .qr-code {\n display: none;\n\n .qr-code-image {\n display: inline-block;\n min-width: 200px;\n width: 40%;\n margin-top: 15px;\n\n span {\n display: inline-block;\n width: 100%;\n margin: 8px 0;\n }\n }\n\n .image {\n width: 200px;\n height: 200px;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_reward.scss","// ==============================\n// Post footer\n// ==============================\n\n.post-footer {\n margin-top: $post-footer-margin-top;\n margin-bottom: 40px;\n border-top: $post-footer-border-top;\n font-family: $global-serif-font-family;\n\n .post-tags {\n padding: $post-tags-padding;\n\n a {\n margin-right: 5px;\n color: $theme-color;\n word-break: break-all;\n\n &::before {\n content: '#';\n }\n }\n }\n\n .post-nav {\n margin: 1em 0;\n @include clearfix;\n\n .prev,\n .next {\n font-weight: 600;\n font-size: $post-nav-font-size;\n font-family: $global-serif-font-family;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s;\n }\n\n .prev {\n float: left;\n\n &:hover {\n color: $theme-color;\n transform: translateX(-4px); \n }\n }\n\n .next {\n float: right;\n\n &:hover {\n color: $theme-color;\n transform: translateX(4px); \n }\n }\n\n .nav-mobile {\n display: none;\n }\n }\n}\n\n@include max-screen() {\n .post-footer {\n .post-nav {\n .nav-default {\n display: none;\n }\n\n .nav-mobile {\n display: inline;\n }\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_footer.scss","// ==============================\n// Post disqus\n// ==============================\n\n.disqus-button {\n display: block;\n padding: 15px 0;\n font-size: 16px;\n color: #555;\n border: 1px solid #ddd;\n text-align: center;\n cursor:pointer;\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_post/_disqus.scss","// ==============================\n// Pagination\n// ==============================\n\n.pagination {\n margin: $pagination-margin;\n text-align: center;\n @include clearfix;\n\n li {\n display: inline-block;\n\n a {\n background-color: #fff;\n margin-left: .1em;\n margin-right: .1em;\n border: 1px solid #222;\n color: #222;\n float: left;\n line-height: 1.42857143;\n padding: 6px 12px;\n position: relative;\n text-decoration: none;\n margin-bottom: 0.2em;\n }\n }\n\n .active {\n a {\n background-color: #222;\n border-color: #222;\n color: #fff;\n cursor: default;\n z-index: 2;\n }\n }\n // .prev,\n // .next {\n // font-weight: 600;\n // font-size: $pagination-font-size;\n // font-family: $global-serif-font-family;\n // transition-property: transform;\n // transition-timing-function: ease-out;\n // transition-duration: 0.3s;\n // }\n\n // .prev {\n // float: left;\n\n // &:hover {\n // color: $theme-color;\n // transform: translateX(-4px); \n // }\n // }\n\n // .next {\n // float: right;\n\n // &:hover {\n // color: $theme-color;\n // transform: translateX(4px); \n // }\n // }\n}\n\n@include max-screen() {\n .pagination {\n margin: 1em 0;\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_pagination.scss","// ==============================\n// Post footer\n// =============================\n\n.footer {\n margin-top: $footer-margin-top;\n\n @import \"_footer/social\";\n @import \"_footer/copyright\";\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_footer.scss","// ==============================\n// Social\n// =============================\n\n.social-links {\n text-align: center;\n\n .iconfont {\n font-size: $social-icon-font-size;\n\n & + .iconfont {\n margin-left: $social-link-margin-left;\n } \n\n &:hover {\n color: $theme-color;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_footer/_social.scss","// ==============================\n// Copyright\n// =============================\n\n.copyright {\n margin: $copyright-margin;\n color: $dark-gray;\n text-align: center;\n font-family: $global-serif-font-family;\n\n .hexo-link,\n .theme-link {\n color: $theme-color;\n }\n\n .copyright-year {\n display: block;\n\n .heart {\n font-size: 14px;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_footer/_copyright.scss","// ==============================\n// Archive\n// =============================\n\n.archive {\n // margin: $archive-margin;\n // max-width: $archive-max-width;\n margin: 0 5em 3em;\n background-color: white;\n padding: 1em 5em 5em 5em;\n\n .archive-title {\n font-family: $global-serif-font-family;\n\n &.tag,\n &.category {\n margin: 20px 0;\n }\n\n .archive-name {\n margin: 0;\n display: inline-block;\n font-weight: 400;\n font-size: $archive-name-font-size;\n line-height: $archive-name-font-size + 2px;\n }\n\n .archive-post-counter {\n display: none;\n color: $dark-gray;\n }\n }\n\n .collection-title {\n font-family: $global-serif-font-family;\n \n .archive-year {\n margin: 2em 0 0;\n font-weight: 400;\n font-size: $collection-title-font-size;\n line-height: $collection-title-font-size + 2px;\n }\n }\n\n .archive-post {\n padding: $archive-post-padding;\n border-bottom: $archive-post-border;\n font-size: 1.1em;\n\n .archive-post-time {\n margin-right: 50px;\n color: $dark-gray;\n }\n\n .archive-post-title {\n \n .archive-post-link {\n color: $theme-color;\n }\n }\n\n &::first-child {\n margin-top: 10px;\n }\n\n &:hover {\n // border-left: $archive-post-hover-border-left;\n transition: $archive-post-hover-transition;\n transform: $archive-post-hover-transform;\n\n .archive-post-time {\n color: darken($dark-gray, 10%);\n }\n\n .archive-post-title .archive-post-link {\n color: darken($theme-color, 10%);\n }\n }\n }\n\n .more-post {\n text-align: right;\n \n .more-post-link {\n margin-top: 1em;\n color: $theme-color;\n font-size: 1.1em;\n font-family: $global-serif-font-family;\n \n &:hover {\n border-bottom: $post-readMore-border-bottom;\n }\n }\n }\n}\n\n@media screen and (max-width: 899px) {\n .archive {\n margin: 0 auto 1em auto;\n padding: 1em;\n\n .archive-title .archive-name {\n font-size: $archive-name-font-size - 4px;\n }\n\n .collection-title .archive-year {\n margin: 10px 0;\n font-size: $collection-title-font-size - 4px;\n }\n\n .archive-post {\n padding: $archive-post-mobile-padding;\n\n .archive-post-time {\n font-size: $archive-post-mobile-time-font-size;\n display: block;\n }\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_archive.scss","// ==============================\n// Tags\n// =============================\n\n.tag-cloud {\n margin: 2em 0 3em;\n text-align: center;\n font-family: $global-serif-font-family;\n\n .tag-cloud-title {\n display: inline-block;\n font-size: $tag-cloud-title-size;\n color: $theme-color;\n border-bottom: $tag-cloud-title-border-bottom;\n }\n\n .tag-cloud-tags {\n margin: 10px 0;\n\n a {\n display: inline-block;\n position: relative;\n margin: $tag-cloud-tags-link-margin;\n word-wrap: break-word;\n transition-duration: 0.2s;\n transition-property: transform;\n transition-timing-function: ease-out;\n\n .tag-count {\n display: inline-block;\n position: relative;\n top: -8px;\n right: -2px;\n color: $theme-color;\n font-size: $category-count-font-size;\n }\n\n &:active,\n &:focus,\n &:hover {\n color: $theme-color;\n transform: scale(1.1);\n }\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_tags.scss","\n.categories {\n margin: 2em 0 3em;\n text-align: center;\n font-family: $global-serif-font-family;\n\n .categories-title {\n display: inline-block;\n font-size: $categories-title-size;\n color: $theme-color;\n border-bottom: $categories-title-border-bottom;\n }\n\n .categories-tags {\n margin: 10px 0;\n\n .category-link {\n display: inline-block;\n position: relative;\n margin: $categories-tags-link-margin;\n word-wrap: break-word;\n transition-duration: 0.2s;\n transition-property: transform;\n transition-timing-function: ease-out;\n\n .category-count {\n display: inline-block;\n position: relative;\n top: -8px;\n right: -2px;\n color: $theme-color;\n font-size: $category-count-font-size;\n }\n\n &:active,\n &:focus,\n &:hover {\n color: $theme-color;\n transform: scale(1.1);\n }\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_categories.scss","// ==============================\n// slideout (https://github.com/mango/slideout)\n// ==============================\n\n.slideout-menu {\n position: fixed;\n top: 0;\n left: 0px;\n bottom: 0;\n width: 180px;\n min-height: 100vh;\n overflow-y: hidden;\n -webkit-overflow-scrolling: touch;\n z-index: 0;\n display: none;\n}\n\n.slideout-panel {\n position: relative;\n z-index: 1;\n background-color: $white;\n min-height: 100%;\n}\n\n.slideout-open,\n.slideout-open body,\n.slideout-open .slideout-panel {\n overflow: hidden;\n}\n\n.slideout-open .slideout-menu {\n display: block;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_slideout.scss","// ==============================\n// Mobile Navbar\n// ==============================\n\n.mobile-navbar {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: $mobile-navbar-height;\n background: $white;\n box-shadow: 0px 2px 2px $gray;\n text-align: center;\n transition: transform 300ms ease;\n z-index: 99;\n\n &.fixed-open {\n transform: translate3d(180px, 0px, 0px);\n }\n\n .mobile-header-logo {\n display: inline-block;\n margin-right: 50px;\n\n .logo {\n font-size: 22px;\n line-height: $mobile-navbar-height;\n font-family: $logo-font-family;\n }\n }\n\n .mobile-navbar-icon {\n color: $theme-color;\n height: $mobile-navbar-height;\n width: $mobile-navbar-height;\n font-size: 24px;\n text-align: center;\n float: left;\n position: relative;\n transition: background 0.5s;\n\n @include mobile-menu-icon();\n }\n}\n\n.mobile-menu {\n background-color: rgba($deputy-color, 0.5);\n\n .mobile-menu-list {\n position: relative;\n list-style: none;\n margin-top: 50px;\n padding: 0;\n border-top: 1px solid $deputy-color;\n\n .mobile-menu-item {\n padding: 10px 30px;\n border-bottom: 1px solid $deputy-color;\n }\n\n a {\n font-size: 18px;\n font-family: $global-serif-font-family;\n\n &:hover {\n color: $theme-color;\n }\n }\n }\n}\n\n@include max-screen() {\n .mobile-navbar {\n display: block;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_mobile.scss","// ==============================\n// Back to top\n// =============================\n\n.back-to-top {\n display: none;\n position: fixed;\n right: 20px;\n bottom: 20px;\n transition-property: transform;\n transition-timing-function: ease-out;\n transition-duration: 0.3s;\n z-index: 10;\n\n &:hover {\n transform: translateY(-5px); \n }\n}\n\n@include max-screen() {\n .back-to-top {\n display: none !important;\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_back-to-top.scss","// ==============================\n// Archive\n// =============================\n\n.not-found {\n text-align: center;\n\n .error-emoji {\n color: #363636;\n font-size: 3rem;\n }\n\n .error-text {\n color: #797979;\n font-size: 1.25rem;\n }\n\n .error-link {\n margin-top: 2rem;\n\n a {\n color: $theme-color;\n }\n }\n}\n\n\n// WEBPACK FOOTER //\n// ./css/_partial/_404.scss"],"sourceRoot":""} \ No newline at end of file
diff --git a/dist/jane.min.js.map b/dist/jane.min.js.map
index 814238f..5ebef76 100644
--- a/dist/jane.min.js.map
+++ b/dist/jane.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/bootstrap ce3cb9d6a5c7e43bce65","webpack:///./js/main.js","webpack:///./js/jane.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","_jane","$","document","ready","Jane","backToTop","mobileNavbar","toc","fancybox","hljs","initHighlighting","highlight","$backToTop","window","scroll","scrollTop","fadeIn","fadeOut","click","animate","$mobileNav","$mobileNavIcon","slideout","Slideout","panel","getElementById","menu","padding","tolerance","disableTouch","toggle","on","addClass","removeClass","isOpen","$toc","$footer","length","css","minScrollTop","offset","top","maxScrollTop","height","tocState","start","position","process","end","$toclink","$headerlink","$tocLinkLis","headerlinkTop","map","link","headerLinksOffsetForSearch","activeTocIndex","array","target","searchActiveTocIndex","ancestor","parentNode","tagName","each","this","find","wrap","src","title","selector","protect","blocks","querySelectorAll","block","rootElement","parentElement","lineCodes","innerHTML","split","slice","lineLength","codeLineHtml","codeHtml","className","figure","createElement","replaceChild","tocContainer","removeChild","_refactorToc","oldTocList","children","newTocList","temp","links","num","headers","header","id"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAhB,GACA,IAAAS,EAAAT,KAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,OAAAR,OAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,kCC7DA,IAAAC,EAAA3B,EAAA,GAEAA,EAAA,GAEA4B,EAAEC,UAAUC,MAAM,WAChBH,EAAAI,KAAKC,YACLL,EAAAI,KAAKE,eACLN,EAAAI,KAAKG,MACLP,EAAAI,KAAKI,aAGPC,KAAKC,mBACLV,EAAAI,KAAKO,2FCVL,IAAMP,GAENA,UAAiB,WACf,IAAMQ,EAAaX,EAAE,gBAErBA,EAAEY,QAAQC,OAAO,WACXb,EAAEY,QAAQE,YAAc,IAC1BH,EAAWI,OAAO,KAElBJ,EAAWK,QAAQ,OAIvBL,EAAWM,MAAM,WACfjB,EAAE,aAAakB,SAAUJ,UAAW,OAIxCX,aAAoB,WAClB,IAAMgB,EAAanB,EAAE,kBACfoB,EAAiBpB,EAAE,uBACnBqB,EAAW,IAAIC,UACnBC,MAAStB,SAASuB,eAAe,gBACjCC,KAAQxB,SAASuB,eAAe,eAChCE,QAAW,IACXC,UAAa,KAEfN,EAASO,eAETR,EAAeH,MAAM,WACnBI,EAASQ,WAGXR,EAASS,GAAG,aAAc,WACxBX,EAAWY,SAAS,cACpBX,EAAeW,SAAS,cAAcC,YAAY,cAGpDX,EAASS,GAAG,cAAe,WACzBX,EAAWa,YAAY,cACvBZ,EAAeW,SAAS,YAAYC,YAAY,gBAGlDhC,EAAE,iBAAiB8B,GAAG,WAAY,WAChCT,EAASY,UAAYb,EAAeH,WAIxCd,SAAgB,WACd,IACM+B,EAAOlC,EAAE,aACTmC,EAAUnC,EAAE,gBAElB,GAAIkC,EAAKE,OAAQ,CACfpC,EAAE,YAAYqC,IAAI,QAAS,QAC3BrC,EAAE,SAASqC,IAAI,cAAe,QAG9B,IAAMC,EAAeJ,EAAKK,SAASC,IATrB,GAURC,EAAeN,EAAQI,SAASC,IAAMN,EAAKQ,SAVnC,GAYRC,GACJC,OACEC,SAAY,WACZL,IAAOF,GAETQ,SACED,SAAY,QACZL,IAnBU,IAqBZO,KACEF,SAAY,WACZL,IAAOC,IAIXzC,EAAEY,QAAQC,OAAO,WACf,IAAMC,EAAYd,EAAEY,QAAQE,YAExBA,EAAYwB,EACdJ,EAAKG,IAAIM,EAASC,OACT9B,EAAY2B,EACrBP,EAAKG,IAAIM,EAASI,KAElBb,EAAKG,IAAIM,EAASG,WAKxB,IACME,EAAWhD,EAAE,aACbiD,EAAcjD,EAAE,eAChBkD,EAAclD,EAAE,wBAEhBmD,EAAgBnD,EAAEoD,IAAIH,EAAa,SAAUI,GACjD,OAAOrD,EAAEqD,GAAMd,SAASC,MAGpBc,EAA6BtD,EAAEoD,IAAID,EAAe,SAAUZ,GAChE,OAAOA,EAVS,KAqBlBvC,EAAEY,QAAQC,OAAO,WACf,IAAMC,EAAYd,EAAEY,QAAQE,YACtByC,EAVqB,SAAUC,EAAOC,GAC5C,IAAK,IAAIjF,EAAI,EAAGA,EAAIgF,EAAMpB,OAAS,EAAG5D,IACpC,GAAIiF,EAASD,EAAMhF,IAAMiF,GAAUD,EAAMhF,EAAI,GAAI,OAAOA,EAE1D,OAAIiF,EAASD,EAAMA,EAAMpB,OAAS,GAAWoB,EAAMpB,OAAS,GACpD,EAKesB,CAAqBJ,EAA4BxC,GAKxE,GAHAd,EAAEgD,GAAUhB,YAAY,UACxBhC,EAAEkD,GAAalB,YAAY,eAEH,IAApBuB,EAAuB,CACzBvD,EAAEgD,EAASO,IAAiBxB,SAAS,UAErC,IADA,IAAI4B,EAAWX,EAASO,GAAgBK,WACZ,QAArBD,EAASE,SACd7D,EAAE2D,GAAU5B,SAAS,cACrB4B,EAAWA,EAASC,WAAWA,eAMvCzD,SAAgB,WACVH,EAAEO,WACJP,EAAE,iBAAiB8D,KAAK,WACtB9D,EAAE+D,MAAMC,KAAK,OAAOF,KAAK,WACvB9D,EAAE+D,MAAME,KAAR,6BAA0CF,KAAKG,IAA/C,2CAA6FH,KAAKI,MAAlG,cAIJnE,EAAE,aAAaO,UACb6D,SAAU,YACVC,SAAS,MAKflE,UAAiB,WAEf,IADA,IAAMmE,EAASrE,SAASsE,iBAAiB,YAChC/F,EAAI,EAAGA,EAAI8F,EAAOlC,OAAQ5D,IAAK,CAOtC,IANA,IAAMgG,EAAQF,EAAO9F,GACfiG,EAAcD,EAAME,cACpBC,EAAYH,EAAMI,UAAUC,MAAM,MAAMC,MAAM,GAAI,GAClDC,EAAaJ,EAAUvC,OAEzB4C,EAAe,GACVxG,EAAI,EAAGA,EAAIuG,EAAYvG,IAC9BwG,yBAAqCxG,EAAI,GAAzC,SAIF,IADA,IAAIyG,EAAW,GACNzG,EAAI,EAAGA,EAAIuG,EAAYvG,IAC9ByG,wBAAiCN,EAAUnG,GAA3C,SAGFgG,EAAMU,WAAa,aACnB,IAAMC,EAASlF,SAASmF,cAAc,UACtCD,EAAOD,UAAYV,EAAMU,UACzBC,EAAOP,UAAP,6CAAgEI,EAAhE,oCAAgHC,EAAhH,mCAEAR,EAAYC,cAAcW,aAAaF,EAAQV,KAInDtE,IAAW,WACT,IAAMmF,EAAerF,SAASuB,eAAe,YAC7C,GAAqB,OAAjB8D,EAAuB,CACzB,IAAMhF,EAAML,SAASuB,eAAe,mBACxB,OAARlB,EAEFgF,EAAa1B,WAAW2B,YAAYD,GAEpCvB,KAAKyB,aAAalF,KAOxBH,aAAoB,SAAUG,GAI5B,IAHA,IAAMmF,EAAanF,EAAIoF,SAAS,GAC5BC,EAAaF,EACbG,SACkC,IAA/BD,EAAWD,SAAStD,QAAwE,QAAvDwD,EAAOD,EAAWD,SAAS,GAAGA,SAAS,IAAI7B,SAAkB8B,EAAaC,EAElHD,IAAeF,GAAYnF,EAAI+E,aAAaM,EAAYF,IAG9DtF,SAAgB,WAEd,IADA,IAAM0F,EAAQ5F,SAASsE,iBAAiB,sBAC/B/F,EAAI,EAAGA,EAAIqH,EAAMzD,OAAQ5D,IAAKqH,EAAMrH,GAAG0G,WAAa,YAE7D,IAAK,IAAIY,EAAM,EAAGA,GAAO,EAAGA,IAE1B,IADA,IAAMC,EAAU9F,SAASsE,iBAAiB,kBAAoBuB,GACrDtH,EAAI,EAAGA,EAAIuH,EAAQ3D,OAAQ5D,IAAK,CACvC,IAAMwH,EAASD,EAAQvH,GACvBwH,EAAOpB,UAAP,aAAgCoB,EAAOC,GAAvC,+BAAwED,EAAOpB,UAA/E,SAAiGoB,EAAOpB,eAKtGzE","file":"jane.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ce3cb9d6a5c7e43bce65","import {Jane} from './jane.js'\n\nimport '../css/style.scss'\n\n$(document).ready(function () {\n Jane.backToTop()\n Jane.mobileNavbar()\n Jane.toc()\n Jane.fancybox()\n})\n\nhljs.initHighlighting()\nJane.highlight()\n\n\n\n// WEBPACK FOOTER //\n// ./js/main.js","'use strict'\n\nconst Jane = {}\n\nJane.backToTop = function () {\n const $backToTop = $('#back-to-top')\n\n $(window).scroll(function () {\n if ($(window).scrollTop() > 100) {\n $backToTop.fadeIn(1000)\n } else {\n $backToTop.fadeOut(1000)\n }\n })\n\n $backToTop.click(function () {\n $('body,html').animate({ scrollTop: 0 })\n })\n}\n\nJane.mobileNavbar = function () {\n const $mobileNav = $('#mobile-navbar')\n const $mobileNavIcon = $('.mobile-navbar-icon')\n const slideout = new Slideout({\n 'panel': document.getElementById('mobile-panel'),\n 'menu': document.getElementById('mobile-menu'),\n 'padding': 180,\n 'tolerance': 70\n })\n slideout.disableTouch()\n\n $mobileNavIcon.click(function () {\n slideout.toggle()\n })\n\n slideout.on('beforeopen', function () {\n $mobileNav.addClass('fixed-open')\n $mobileNavIcon.addClass('icon-click').removeClass('icon-out')\n })\n\n slideout.on('beforeclose', function () {\n $mobileNav.removeClass('fixed-open')\n $mobileNavIcon.addClass('icon-out').removeClass('icon-click')\n })\n\n $('#mobile-panel').on('touchend', function () {\n slideout.isOpen() && $mobileNavIcon.click()\n })\n}\n\nJane._initToc = function () {\n const SPACING = 20\n const $toc = $('.post-toc')\n const $footer = $('.post-footer')\n\n if ($toc.length) {\n $('.content').css('width', '65em')\n $('.post').css('margin-left', '15em')\n // $('.content').css('background-color', '#fff')\n\n const minScrollTop = $toc.offset().top - SPACING\n const maxScrollTop = $footer.offset().top - $toc.height() - SPACING\n\n const tocState = {\n start: {\n 'position': 'absolute',\n 'top': minScrollTop\n },\n process: {\n 'position': 'fixed',\n 'top': SPACING\n },\n end: {\n 'position': 'absolute',\n 'top': maxScrollTop\n }\n }\n\n $(window).scroll(function () {\n const scrollTop = $(window).scrollTop()\n\n if (scrollTop < minScrollTop) {\n $toc.css(tocState.start)\n } else if (scrollTop > maxScrollTop) {\n $toc.css(tocState.end)\n } else {\n $toc.css(tocState.process)\n }\n })\n }\n\n const HEADERFIX = 30\n const $toclink = $('.toc-link')\n const $headerlink = $('.headerlink')\n const $tocLinkLis = $('.post-toc-content li')\n\n const headerlinkTop = $.map($headerlink, function (link) {\n return $(link).offset().top\n })\n\n const headerLinksOffsetForSearch = $.map(headerlinkTop, function (offset) {\n return offset - HEADERFIX\n })\n\n const searchActiveTocIndex = function (array, target) {\n for (let i = 0; i < array.length - 1; i++) {\n if (target > array[i] && target <= array[i + 1]) return i\n }\n if (target > array[array.length - 1]) return array.length - 1\n return -1\n }\n\n $(window).scroll(function () {\n const scrollTop = $(window).scrollTop()\n const activeTocIndex = searchActiveTocIndex(headerLinksOffsetForSearch, scrollTop)\n\n $($toclink).removeClass('active')\n $($tocLinkLis).removeClass('has-active')\n\n if (activeTocIndex !== -1) {\n $($toclink[activeTocIndex]).addClass('active')\n let ancestor = $toclink[activeTocIndex].parentNode\n while (ancestor.tagName !== 'NAV') {\n $(ancestor).addClass('has-active')\n ancestor = ancestor.parentNode.parentNode\n }\n }\n })\n}\n\nJane.fancybox = function () {\n if ($.fancybox) {\n $('.post-content').each(function () {\n $(this).find('img').each(function () {\n $(this).wrap(`<a class=\"fancybox\" href=\"${this.src}\" data-fancybox=\"gallery\" data-caption=\"${this.title}\"></a>`)\n })\n })\n\n $('.fancybox').fancybox({\n selector: '.fancybox',\n protect: true\n })\n }\n}\n\nJane.highlight = function () {\n const blocks = document.querySelectorAll('pre code')\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i]\n const rootElement = block.parentElement\n const lineCodes = block.innerHTML.split(/\\n/).slice(0, -1)\n const lineLength = lineCodes.length\n\n let codeLineHtml = ''\n for (let i = 0; i < lineLength; i++) {\n codeLineHtml += `<div class=\"line\">${i + 1}</div>`\n }\n\n let codeHtml = ''\n for (let i = 0; i < lineLength; i++) {\n codeHtml += `<div class=\"line\">${lineCodes[i]}</div>`\n }\n\n block.className += ' highlight'\n const figure = document.createElement('figure')\n figure.className = block.className\n figure.innerHTML = `<table><tbody><tr><td class=\"gutter\"><pre>${codeLineHtml}</pre></td><td class=\"code\"><pre>${codeHtml}</pre></td></tr></tbody></table>`\n\n rootElement.parentElement.replaceChild(figure, rootElement)\n }\n}\n\nJane.toc = function () {\n const tocContainer = document.getElementById('post-toc')\n if (tocContainer !== null) {\n const toc = document.getElementById('TableOfContents')\n if (toc === null) {\n // toc = true, but there are no headings\n tocContainer.parentNode.removeChild(tocContainer)\n } else {\n this._refactorToc(toc)\n // this._linkToc()\n // this._initToc()\n }\n }\n}\n\nJane._refactorToc = function (toc) {\n const oldTocList = toc.children[0]\n let newTocList = oldTocList\n let temp\n while (newTocList.children.length === 1 && (temp = newTocList.children[0].children[0]).tagName === 'UL') newTocList = temp\n\n if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList)\n}\n\nJane._linkToc = function () {\n const links = document.querySelectorAll('#TableOfContents a')\n for (let i = 0; i < links.length; i++) links[i].className += ' toc-link'\n\n for (let num = 1; num <= 6; num++) {\n const headers = document.querySelectorAll('.post-content>h' + num)\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i]\n header.innerHTML = `<a href=\"#${header.id}\" class=\"headerlink\" title=\"${header.innerHTML}\"></a>${header.innerHTML}`\n }\n }\n}\n\nexport {Jane}\n\n\n\n// WEBPACK FOOTER //\n// ./js/jane.js"],"sourceRoot":""} \ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/bootstrap 989b23fc46f12de9b854","webpack:///./js/main.js","webpack:///./js/jane.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","_jane","$","document","ready","Jane","backToTop","mobileNavbar","toc","fancybox","hljs","initHighlighting","highlight","$backToTop","window","scroll","scrollTop","fadeIn","fadeOut","click","animate","$mobileNav","$mobileNavIcon","slideout","Slideout","panel","getElementById","menu","padding","tolerance","disableTouch","toggle","on","addClass","removeClass","isOpen","$toc","$footer","length","css","minScrollTop","offset","top","maxScrollTop","height","tocState","start","position","process","end","$toclink","$headerlink","$tocLinkLis","headerlinkTop","map","link","headerLinksOffsetForSearch","activeTocIndex","array","target","searchActiveTocIndex","ancestor","parentNode","tagName","each","this","find","wrap","src","title","selector","protect","blocks","querySelectorAll","block","rootElement","parentElement","lineCodes","innerHTML","split","slice","lineLength","codeLineHtml","codeHtml","className","figure","createElement","replaceChild","tocContainer","removeChild","_refactorToc","oldTocList","children","newTocList","temp","links","num","headers","header","id"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAhB,GACA,IAAAS,EAAAT,KAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,OAAAR,OAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,kCC7DA,IAAAC,EAAA3B,EAAA,GAEAA,EAAA,GAEA4B,EAAEC,UAAUC,MAAM,WAChBH,EAAAI,KAAKC,YACLL,EAAAI,KAAKE,eACLN,EAAAI,KAAKG,MACLP,EAAAI,KAAKI,aAGPC,KAAKC,mBACLV,EAAAI,KAAKO,2FCVL,IAAMP,GAENA,UAAiB,WACf,IAAMQ,EAAaX,EAAE,gBAErBA,EAAEY,QAAQC,OAAO,WACXb,EAAEY,QAAQE,YAAc,IAC1BH,EAAWI,OAAO,KAElBJ,EAAWK,QAAQ,OAIvBL,EAAWM,MAAM,WACfjB,EAAE,aAAakB,SAAUJ,UAAW,OAIxCX,aAAoB,WAClB,IAAMgB,EAAanB,EAAE,kBACfoB,EAAiBpB,EAAE,uBACnBqB,EAAW,IAAIC,UACnBC,MAAStB,SAASuB,eAAe,gBACjCC,KAAQxB,SAASuB,eAAe,eAChCE,QAAW,IACXC,UAAa,KAEfN,EAASO,eAETR,EAAeH,MAAM,WACnBI,EAASQ,WAGXR,EAASS,GAAG,aAAc,WACxBX,EAAWY,SAAS,cACpBX,EAAeW,SAAS,cAAcC,YAAY,cAGpDX,EAASS,GAAG,cAAe,WACzBX,EAAWa,YAAY,cACvBZ,EAAeW,SAAS,YAAYC,YAAY,gBAGlDhC,EAAE,iBAAiB8B,GAAG,WAAY,WAChCT,EAASY,UAAYb,EAAeH,WAIxCd,SAAgB,WACd,IACM+B,EAAOlC,EAAE,aACTmC,EAAUnC,EAAE,gBAElB,GAAIkC,EAAKE,OAAQ,CACfpC,EAAE,YAAYqC,IAAI,QAAS,QAC3BrC,EAAE,SAASqC,IAAI,cAAe,QAG9B,IAAMC,EAAeJ,EAAKK,SAASC,IATrB,GAURC,EAAeN,EAAQI,SAASC,IAAMN,EAAKQ,SAVnC,GAYRC,GACJC,OACEC,SAAY,WACZL,IAAOF,GAETQ,SACED,SAAY,QACZL,IAnBU,IAqBZO,KACEF,SAAY,WACZL,IAAOC,IAIXzC,EAAEY,QAAQC,OAAO,WACf,IAAMC,EAAYd,EAAEY,QAAQE,YAExBA,EAAYwB,EACdJ,EAAKG,IAAIM,EAASC,OACT9B,EAAY2B,EACrBP,EAAKG,IAAIM,EAASI,KAElBb,EAAKG,IAAIM,EAASG,WAKxB,IACME,EAAWhD,EAAE,aACbiD,EAAcjD,EAAE,eAChBkD,EAAclD,EAAE,wBAEhBmD,EAAgBnD,EAAEoD,IAAIH,EAAa,SAAUI,GACjD,OAAOrD,EAAEqD,GAAMd,SAASC,MAGpBc,EAA6BtD,EAAEoD,IAAID,EAAe,SAAUZ,GAChE,OAAOA,EAVS,KAqBlBvC,EAAEY,QAAQC,OAAO,WACf,IAAMC,EAAYd,EAAEY,QAAQE,YACtByC,EAVqB,SAAUC,EAAOC,GAC5C,IAAK,IAAIjF,EAAI,EAAGA,EAAIgF,EAAMpB,OAAS,EAAG5D,IACpC,GAAIiF,EAASD,EAAMhF,IAAMiF,GAAUD,EAAMhF,EAAI,GAAI,OAAOA,EAE1D,OAAIiF,EAASD,EAAMA,EAAMpB,OAAS,GAAWoB,EAAMpB,OAAS,GACpD,EAKesB,CAAqBJ,EAA4BxC,GAKxE,GAHAd,EAAEgD,GAAUhB,YAAY,UACxBhC,EAAEkD,GAAalB,YAAY,eAEH,IAApBuB,EAAuB,CACzBvD,EAAEgD,EAASO,IAAiBxB,SAAS,UAErC,IADA,IAAI4B,EAAWX,EAASO,GAAgBK,WACZ,QAArBD,EAASE,SACd7D,EAAE2D,GAAU5B,SAAS,cACrB4B,EAAWA,EAASC,WAAWA,eAMvCzD,SAAgB,WACVH,EAAEO,WACJP,EAAE,iBAAiB8D,KAAK,WACtB9D,EAAE+D,MAAMC,KAAK,OAAOF,KAAK,WACvB9D,EAAE+D,MAAME,KAAR,6BAA0CF,KAAKG,IAA/C,2CAA6FH,KAAKI,MAAlG,cAIJnE,EAAE,aAAaO,UACb6D,SAAU,YACVC,SAAS,MAKflE,UAAiB,WAEf,IADA,IAAMmE,EAASrE,SAASsE,iBAAiB,YAChC/F,EAAI,EAAGA,EAAI8F,EAAOlC,OAAQ5D,IAAK,CAOtC,IANA,IAAMgG,EAAQF,EAAO9F,GACfiG,EAAcD,EAAME,cACpBC,EAAYH,EAAMI,UAAUC,MAAM,MAAMC,MAAM,GAAI,GAClDC,EAAaJ,EAAUvC,OAEzB4C,EAAe,GACVxG,EAAI,EAAGA,EAAIuG,EAAYvG,IAC9BwG,yBAAqCxG,EAAI,GAAzC,SAIF,IADA,IAAIyG,EAAW,GACNzG,EAAI,EAAGA,EAAIuG,EAAYvG,IAC9ByG,wBAAiCN,EAAUnG,GAA3C,SAGFgG,EAAMU,WAAa,aACnB,IAAMC,EAASlF,SAASmF,cAAc,UACtCD,EAAOD,UAAYV,EAAMU,UACzBC,EAAOP,UAAP,6CAAgEI,EAAhE,oCAAgHC,EAAhH,mCAEAR,EAAYC,cAAcW,aAAaF,EAAQV,KAInDtE,IAAW,WACT,IAAMmF,EAAerF,SAASuB,eAAe,YAC7C,GAAqB,OAAjB8D,EAAuB,CACzB,IAAMhF,EAAML,SAASuB,eAAe,mBACxB,OAARlB,EAEFgF,EAAa1B,WAAW2B,YAAYD,GAEpCvB,KAAKyB,aAAalF,KAOxBH,aAAoB,SAAUG,GAI5B,IAHA,IAAMmF,EAAanF,EAAIoF,SAAS,GAC5BC,EAAaF,EACbG,SACkC,IAA/BD,EAAWD,SAAStD,QAAwE,QAAvDwD,EAAOD,EAAWD,SAAS,GAAGA,SAAS,IAAI7B,SAAkB8B,EAAaC,EAElHD,IAAeF,GAAYnF,EAAI+E,aAAaM,EAAYF,IAG9DtF,SAAgB,WAEd,IADA,IAAM0F,EAAQ5F,SAASsE,iBAAiB,sBAC/B/F,EAAI,EAAGA,EAAIqH,EAAMzD,OAAQ5D,IAAKqH,EAAMrH,GAAG0G,WAAa,YAE7D,IAAK,IAAIY,EAAM,EAAGA,GAAO,EAAGA,IAE1B,IADA,IAAMC,EAAU9F,SAASsE,iBAAiB,kBAAoBuB,GACrDtH,EAAI,EAAGA,EAAIuH,EAAQ3D,OAAQ5D,IAAK,CACvC,IAAMwH,EAASD,EAAQvH,GACvBwH,EAAOpB,UAAP,aAAgCoB,EAAOC,GAAvC,+BAAwED,EAAOpB,UAA/E,SAAiGoB,EAAOpB,eAKtGzE","file":"jane.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 989b23fc46f12de9b854","import {Jane} from './jane.js'\n\nimport '../css/style.scss'\n\n$(document).ready(function () {\n Jane.backToTop()\n Jane.mobileNavbar()\n Jane.toc()\n Jane.fancybox()\n})\n\nhljs.initHighlighting()\nJane.highlight()\n\n\n\n// WEBPACK FOOTER //\n// ./js/main.js","'use strict'\n\nconst Jane = {}\n\nJane.backToTop = function () {\n const $backToTop = $('#back-to-top')\n\n $(window).scroll(function () {\n if ($(window).scrollTop() > 100) {\n $backToTop.fadeIn(1000)\n } else {\n $backToTop.fadeOut(1000)\n }\n })\n\n $backToTop.click(function () {\n $('body,html').animate({ scrollTop: 0 })\n })\n}\n\nJane.mobileNavbar = function () {\n const $mobileNav = $('#mobile-navbar')\n const $mobileNavIcon = $('.mobile-navbar-icon')\n const slideout = new Slideout({\n 'panel': document.getElementById('mobile-panel'),\n 'menu': document.getElementById('mobile-menu'),\n 'padding': 180,\n 'tolerance': 70\n })\n slideout.disableTouch()\n\n $mobileNavIcon.click(function () {\n slideout.toggle()\n })\n\n slideout.on('beforeopen', function () {\n $mobileNav.addClass('fixed-open')\n $mobileNavIcon.addClass('icon-click').removeClass('icon-out')\n })\n\n slideout.on('beforeclose', function () {\n $mobileNav.removeClass('fixed-open')\n $mobileNavIcon.addClass('icon-out').removeClass('icon-click')\n })\n\n $('#mobile-panel').on('touchend', function () {\n slideout.isOpen() && $mobileNavIcon.click()\n })\n}\n\nJane._initToc = function () {\n const SPACING = 20\n const $toc = $('.post-toc')\n const $footer = $('.post-footer')\n\n if ($toc.length) {\n $('.content').css('width', '65em')\n $('.post').css('margin-left', '15em')\n // $('.content').css('background-color', '#fff')\n\n const minScrollTop = $toc.offset().top - SPACING\n const maxScrollTop = $footer.offset().top - $toc.height() - SPACING\n\n const tocState = {\n start: {\n 'position': 'absolute',\n 'top': minScrollTop\n },\n process: {\n 'position': 'fixed',\n 'top': SPACING\n },\n end: {\n 'position': 'absolute',\n 'top': maxScrollTop\n }\n }\n\n $(window).scroll(function () {\n const scrollTop = $(window).scrollTop()\n\n if (scrollTop < minScrollTop) {\n $toc.css(tocState.start)\n } else if (scrollTop > maxScrollTop) {\n $toc.css(tocState.end)\n } else {\n $toc.css(tocState.process)\n }\n })\n }\n\n const HEADERFIX = 30\n const $toclink = $('.toc-link')\n const $headerlink = $('.headerlink')\n const $tocLinkLis = $('.post-toc-content li')\n\n const headerlinkTop = $.map($headerlink, function (link) {\n return $(link).offset().top\n })\n\n const headerLinksOffsetForSearch = $.map(headerlinkTop, function (offset) {\n return offset - HEADERFIX\n })\n\n const searchActiveTocIndex = function (array, target) {\n for (let i = 0; i < array.length - 1; i++) {\n if (target > array[i] && target <= array[i + 1]) return i\n }\n if (target > array[array.length - 1]) return array.length - 1\n return -1\n }\n\n $(window).scroll(function () {\n const scrollTop = $(window).scrollTop()\n const activeTocIndex = searchActiveTocIndex(headerLinksOffsetForSearch, scrollTop)\n\n $($toclink).removeClass('active')\n $($tocLinkLis).removeClass('has-active')\n\n if (activeTocIndex !== -1) {\n $($toclink[activeTocIndex]).addClass('active')\n let ancestor = $toclink[activeTocIndex].parentNode\n while (ancestor.tagName !== 'NAV') {\n $(ancestor).addClass('has-active')\n ancestor = ancestor.parentNode.parentNode\n }\n }\n })\n}\n\nJane.fancybox = function () {\n if ($.fancybox) {\n $('.post-content').each(function () {\n $(this).find('img').each(function () {\n $(this).wrap(`<a class=\"fancybox\" href=\"${this.src}\" data-fancybox=\"gallery\" data-caption=\"${this.title}\"></a>`)\n })\n })\n\n $('.fancybox').fancybox({\n selector: '.fancybox',\n protect: true\n })\n }\n}\n\nJane.highlight = function () {\n const blocks = document.querySelectorAll('pre code')\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i]\n const rootElement = block.parentElement\n const lineCodes = block.innerHTML.split(/\\n/).slice(0, -1)\n const lineLength = lineCodes.length\n\n let codeLineHtml = ''\n for (let i = 0; i < lineLength; i++) {\n codeLineHtml += `<div class=\"line\">${i + 1}</div>`\n }\n\n let codeHtml = ''\n for (let i = 0; i < lineLength; i++) {\n codeHtml += `<div class=\"line\">${lineCodes[i]}</div>`\n }\n\n block.className += ' highlight'\n const figure = document.createElement('figure')\n figure.className = block.className\n figure.innerHTML = `<table><tbody><tr><td class=\"gutter\"><pre>${codeLineHtml}</pre></td><td class=\"code\"><pre>${codeHtml}</pre></td></tr></tbody></table>`\n\n rootElement.parentElement.replaceChild(figure, rootElement)\n }\n}\n\nJane.toc = function () {\n const tocContainer = document.getElementById('post-toc')\n if (tocContainer !== null) {\n const toc = document.getElementById('TableOfContents')\n if (toc === null) {\n // toc = true, but there are no headings\n tocContainer.parentNode.removeChild(tocContainer)\n } else {\n this._refactorToc(toc)\n // this._linkToc()\n // this._initToc()\n }\n }\n}\n\nJane._refactorToc = function (toc) {\n const oldTocList = toc.children[0]\n let newTocList = oldTocList\n let temp\n while (newTocList.children.length === 1 && (temp = newTocList.children[0].children[0]).tagName === 'UL') newTocList = temp\n\n if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList)\n}\n\nJane._linkToc = function () {\n const links = document.querySelectorAll('#TableOfContents a')\n for (let i = 0; i < links.length; i++) links[i].className += ' toc-link'\n\n for (let num = 1; num <= 6; num++) {\n const headers = document.querySelectorAll('.post-content>h' + num)\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i]\n header.innerHTML = `<a href=\"#${header.id}\" class=\"headerlink\" title=\"${header.innerHTML}\"></a>${header.innerHTML}`\n }\n }\n}\n\nexport {Jane}\n\n\n\n// WEBPACK FOOTER //\n// ./js/jane.js"],"sourceRoot":""} \ No newline at end of file
diff --git a/index.html b/index.html
index 89a3d1b..c20a4bd 100644
--- a/index.html
+++ b/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Jane - A simple theme for Hugo" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -314,15 +317,23 @@ This document is a brief primer on using go templates.
</section>
+
- <nav class="pagination">
-
-
- <a class="next" href="/hugo-theme-jane/page/2/">
- <span class="next-text">Next</span>
- <i class="iconfont icon-right"></i>
- </a>
- </nav>
+
+
+<nav class="pagination">
+
+ <li class="active" >
+ <a href="/hugo-theme-jane/">1</a>
+ </li>
+
+ <li >
+ <a href="/hugo-theme-jane/page/2/">2</a>
+ </li>
+
+</nav>
+
+
</div>
</div>
@@ -380,5 +391,8 @@ This document is a brief primer on using go templates.
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/index.xml b/index.xml
index 64fb308..60b3035 100644
--- a/index.xml
+++ b/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 20 Aug 2017 21:38:52 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,9 +17,21 @@
<pubDate>Sun, 20 Aug 2017 21:38:52 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/about/</guid>
- <description>Hugo is a static site engine written in Go.
-It makes use of a variety of open source projects including:
- Cobra Viper J Walter Weatherman Cast Learn more and contribute on GitHub.</description>
+
+ <description>&lt;p&gt;Hugo is a static site engine written in Go.&lt;/p&gt;
+
+&lt;p&gt;It makes use of a variety of open source projects including:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;&lt;a href=&#34;https://github.com/spf13/cobra&#34;&gt;Cobra&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;&lt;a href=&#34;https://github.com/spf13/viper&#34;&gt;Viper&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;&lt;a href=&#34;https://github.com/spf13/jWalterWeatherman&#34;&gt;J Walter Weatherman&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;&lt;a href=&#34;https://github.com/spf13/cast&#34;&gt;Cast&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;Learn more and contribute on &lt;a href=&#34;https://github.com/gohugoio&#34;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -28,11 +40,336 @@ It makes use of a variety of open source projects including:
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/jane-theme-preview/</guid>
- <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
+
+ <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
&lt;p&gt;Please note that HTML fragments in markdown source will be recognized but not parsed or rendered. Also, there may be small reformatting on the original markdown source code after saving.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;paragraph-and-line-breaks&#34;&gt;Paragraph and line breaks&lt;/h2&gt;
+
+&lt;p&gt;A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by more than one blank lines. In Typora, you only need to press &lt;code&gt;Return&lt;/code&gt; to create a new paragraph.&lt;/p&gt;
+
+&lt;p&gt;Press &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Return&lt;/code&gt; to create a single line break. However, most markdown parser will ignore single line break, to make other markdown parsers recognize your line break, you can leave two whitespace at the end of the line, or insert &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;headers&#34;&gt;Headers&lt;/h2&gt;
+
+&lt;p&gt;Headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;# This is an H1
+
+## This is an H2
+
+###### This is an H6
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, input ‘#’s followed by title content, and press &lt;code&gt;Return&lt;/code&gt; key will create a header.&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Markdown uses email-style &amp;gt; characters for block quoting. They are presented as:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;This is a blockquote with two paragraphs. This is first paragraph.&lt;/p&gt;
+
+&lt;p&gt;This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.&lt;/p&gt;
+
+&lt;p&gt;This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;In typora, just input ‘&amp;gt;’ followed by quote contents a block quote is generated. Typora will insert proper ‘&amp;gt;’ or line break for you. Block quote inside anther block quote is allowed by adding additional levels of ‘&amp;gt;’.&lt;/p&gt;
+
+&lt;h2 id=&#34;lists&#34;&gt;Lists&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;* list item 1&lt;/code&gt; will create an un-ordered list, the &lt;code&gt;*&lt;/code&gt; symbol can be replace with &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;1. list item 1&lt;/code&gt; will create an ordered list, their markdown source code is like:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;task-list&#34;&gt;Task List&lt;/h2&gt;
+
+&lt;p&gt;Task lists are lists with items marked as either [ ] or &lt;a href=&#34;incomplete or complete&#34;&gt;x&lt;/a&gt;. For example:&lt;/p&gt;
+
+&lt;ul class=&#34;task-list&#34;&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; a task list item&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; list syntax required&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; normal &lt;strong&gt;formatting&lt;/strong&gt;, @mentions, #1234 refs&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; incomplete&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; checked disabled class=&#34;task-list-item&#34;&gt; completed&lt;/label&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;You can change the complete/incomplete state by click the checkbox before the item.&lt;/p&gt;
+
+&lt;h2 id=&#34;syntax-highlighting&#34;&gt;Syntax Highlighting&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+ alert(&amp;quot;Hello, World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;math-blocks&#34;&gt;Math Blocks&lt;/h2&gt;
+
+&lt;p&gt;You can render *LaTeX* mathematical expressions using &lt;strong&gt;MathJax&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;$$&lt;/code&gt;, then press &amp;lsquo;Return&amp;rsquo; key will trigger an input field which accept &lt;em&gt;Tex/LaTex&lt;/em&gt; source. Following is an example:
+$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} &lt;br /&gt;
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 &lt;br /&gt;
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 &lt;br /&gt;
+\end{vmatrix}
+$$&lt;/p&gt;
+
+&lt;p&gt;In markdown source file, math block is &lt;em&gt;LaTeX&lt;/em&gt; expression wrapped by ‘$$’ mark:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} \\
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 \\
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 \\
+\end{vmatrix}
+$$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;tables&#34;&gt;Tables&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;| First Header | Second Header |&lt;/code&gt; and press &lt;code&gt;return&lt;/code&gt; key will create a table with two column.&lt;/p&gt;
+
+&lt;p&gt;After table is created, focus on that table will pop up a toolbar for table, where you can resize, align, or delete table. You can also use context menu to copy and add/delete column/row.&lt;/p&gt;
+
+&lt;p&gt;Following descriptions can be skipped, as markdown source code for tables are generated by typora automatically.&lt;/p&gt;
+
+&lt;p&gt;In markdown source code, they look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;| First Header | Second Header |
+| ------------- | ------------- |
+| Content Cell | Content Cell |
+| Content Cell | Content Cell |
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+&lt;tr&gt;
+&lt;th&gt;First Header&lt;/th&gt;
+&lt;th&gt;Second Header&lt;/th&gt;
+&lt;/tr&gt;
+&lt;/thead&gt;
+
+&lt;tbody&gt;
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h2 id=&#34;footnotes&#34;&gt;Footnotes&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;You can create footnotes like this[^footnote].
+
+[^footnote]: Here is the *text* of the **footnote**.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;You can create footnotes like this&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:footnote&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:footnote&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
+
+&lt;p&gt;Mouse on the ‘footnote’ superscript to see content of the footnote.&lt;/p&gt;
+
+&lt;h2 id=&#34;horizontal-rules&#34;&gt;Horizontal Rules&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;***&lt;/code&gt; or &lt;code&gt;---&lt;/code&gt; on a blank line and press &lt;code&gt;return&lt;/code&gt; will draw a horizontal line.&lt;/p&gt;
+
+&lt;hr /&gt;
+
+&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
+
+&lt;p&gt;Markdown supports two style of links: inline and reference.&lt;/p&gt;
+
+&lt;p&gt;In both styles, the link text is delimited by [square brackets].&lt;/p&gt;
+
+&lt;p&gt;To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example](http://example.com/ &amp;quot;Title&amp;quot;) inline link.
+
+[This link](http://example.net/) has no title attribute.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Title&#34;&gt;an example&lt;/a&gt; inline link. (&lt;code&gt;&amp;lt;p&amp;gt;This is &amp;lt;a href=&amp;quot;http://example.com/&amp;quot; title=&amp;quot;Title&amp;quot;&amp;gt;&lt;/code&gt;)&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://example.net/&#34;&gt;This link&lt;/a&gt; has no title attribute. (&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://example.net/&amp;quot;&amp;gt;This link&amp;lt;/a&amp;gt; has no&lt;/code&gt;)&lt;/p&gt;
+
+&lt;h3 id=&#34;internal-links&#34;&gt;Internal Links&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;You can set the href to headers&lt;/strong&gt;, which will create a bookmark that allow you to jump to that section after clicking. For example:&lt;/p&gt;
+
+&lt;p&gt;Command(on Windows: Ctrl) + Click &lt;a href=&#34;#block-elements&#34;&gt;This link&lt;/a&gt; will jump to header &lt;code&gt;Block Elements&lt;/code&gt;. To see how to write that, please move cursor or click that link with &lt;code&gt;⌘&lt;/code&gt; key pressed to expand the element into markdown source.&lt;/p&gt;
+
+&lt;h3 id=&#34;reference-links&#34;&gt;Reference Links&lt;/h3&gt;
+
+&lt;p&gt;Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example][id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this, on a line by itself:
+
+[id]: http://example.com/ &amp;quot;Optional Title Here&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, they will be rendered like:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Optional Title Here&#34;&gt;an example&lt;/a&gt; reference-style link.&lt;/p&gt;
+
+&lt;p&gt;The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;[Google][]
+And then define the link:
+
+[Google]: http://google.com/
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora click link will expand it for editing, command+click will open the hyperlink in web browser.&lt;/p&gt;
+
+&lt;h2 id=&#34;urls&#34;&gt;URLs&lt;/h2&gt;
+
+&lt;p&gt;Typora allows you to insert urls as links, wrapped by &lt;code&gt;&amp;lt;&lt;/code&gt;brackets&lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;i@typora.io&amp;gt;&lt;/code&gt; becomes &lt;a href=&#34;mailto:i@typora.io&#34;&gt;i@typora.io&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Typora will aslo auto link standard URLs. e.g: www.google.com.&lt;/p&gt;
+
+&lt;h2 id=&#34;images&#34;&gt;Images&lt;/h2&gt;
+
+&lt;p&gt;Image looks similar with links, but it requires an additional &lt;code&gt;!&lt;/code&gt; char before the start of link. Image syntax looks like this:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg &amp;quot;Optional title&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;You are able to use drag &amp;amp; drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag &amp;amp; drop.&lt;/p&gt;
+
+&lt;p&gt;For more tips on images, please read &lt;a href=&#34;http://support.typora.io//Images/&#34;&gt;http://support.typora.io//Images/&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;emphasis&#34;&gt;Emphasis&lt;/h2&gt;
+
+&lt;p&gt;Markdown treats asterisks (&lt;code&gt;*&lt;/code&gt;) and underscores (&lt;code&gt;_&lt;/code&gt;) as indicators of emphasis. Text wrapped with one &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt; will be wrapped with an HTML &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag. E.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;*single asterisks*
+
+_single underscores_
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single asterisks&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single underscores&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;GFM will ignores underscores in words, which is commonly used in code and names, like this:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;wow_great_stuff&lt;/p&gt;
+
+&lt;p&gt;do_this_and_do_that_and_another_thing.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;\*this text is surrounded by literal asterisks\*
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;*&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;strong&#34;&gt;Strong&lt;/h2&gt;
+
+&lt;p&gt;double *’s or _’s will be wrapped with an HTML &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag, e.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;**double asterisks**
+
+__double underscores__
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double asterisks&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double underscores&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;**&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
+
+&lt;p&gt;To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;Use the `printf()` function.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
+
+&lt;h2 id=&#34;strikethrough&#34;&gt;Strikethrough&lt;/h2&gt;
+
+&lt;p&gt;GFM adds syntax to create strikethrough text, which is missing from standard Markdown.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;~~Mistaken text.~~&lt;/code&gt; becomes &lt;del&gt;Mistaken text.&lt;/del&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;underline&#34;&gt;Underline&lt;/h2&gt;
+
+&lt;p&gt;Underline is powered by raw HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;u&amp;gt;Underline&amp;lt;/u&amp;gt;&lt;/code&gt; becomes &lt;u&gt;Underline&lt;/u&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;emoji-happy&#34;&gt;Emoji :happy:&lt;/h2&gt;
+
+&lt;p&gt;Input emoji with syntax &lt;code&gt;😄&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;User can trigger auto-complete suggestions for emoji by pressing &lt;code&gt;ESC&lt;/code&gt; key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from &lt;code&gt;Edit&lt;/code&gt; -&amp;gt; &lt;code&gt;Emoji &amp;amp; Symbols&lt;/code&gt; from menu bar is also supported.&lt;/p&gt;
+
+&lt;h2 id=&#34;inline-math&#34;&gt;Inline Math&lt;/h2&gt;
+
+&lt;p&gt;To use this feature, first, please enable it in &lt;code&gt;Preference&lt;/code&gt; Panel -&amp;gt; &lt;code&gt;Markdown&lt;/code&gt; Tab. Then use &lt;code&gt;$&lt;/code&gt; to wrap TeX command, for example: &lt;code&gt;$\lim_{x \to \infty} \exp(-x) = 0$&lt;/code&gt; will be rendered as LaTeX command.&lt;/p&gt;
+
+&lt;p&gt;To trigger inline preview for inline math: input “$”, then press &lt;code&gt;ESC&lt;/code&gt; key, then input TeX command, a preview tooltip will be visible like below:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;http://typora.io/img/inline-math.gif&#34; style=&#34;zoom:50%;&#34; /&gt;&lt;/p&gt;
+&lt;div class=&#34;footnotes&#34;&gt;
+
+&lt;hr /&gt;
+
+&lt;ol&gt;
+&lt;li id=&#34;fn:footnote&#34;&gt;Here is the &lt;em&gt;text&lt;/em&gt; of the &lt;strong&gt;footnote&lt;/strong&gt;.
+ &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:footnote&#34;&gt;&lt;sup&gt;[return]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
+&lt;/ol&gt;
+&lt;/div&gt;</description>
+
</item>
<item>
@@ -41,7 +378,8 @@ It makes use of a variety of open source projects including:
<pubDate>Sun, 04 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/shortcodes-preview/</guid>
- <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
&lt;p&gt;Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video &lt;code&gt;&amp;lt;iframes&amp;gt;&lt;/code&gt;) to Markdown content. We think this contradicts the beautiful simplicity of Markdown&amp;rsquo;s syntax.&lt;/p&gt;
@@ -53,7 +391,381 @@ It makes use of a variety of open source projects including:
&lt;p&gt;More details: &lt;a href=&#34;https://gohugo.io/content-management/shortcodes/&#34;&gt;https://gohugo.io/content-management/shortcodes/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Normal quote:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a simple quote.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote with only an Author named Author2.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author2&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author3 and source &#34;source.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author3&lt;/strong&gt;
+
+ &lt;cite&gt;Source&lt;/cite&gt;
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and link:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author4 and links to https://www.google.com.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author4&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;google.com&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author, link and title:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://www.google.com with title &#34;Google.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author5&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;Google&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and a link longer than 32 characters, string is first cut at 32 characters then everything after the last forward slash is removed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://twitter.com/CryptoGangsta/status/716427930126196737 which is longer than 32 characters.
+ &lt;br&gt;And this is a new line in the quote with the HTML br tag.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author6&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34; title=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34;&gt;twitter.com/CryptoGangsta/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Test from the Octopress blockquote page at: &lt;a href=&#34;http://octopress.org/docs/plugins/blockquote/&#34;&gt;http://octopress.org/docs/plugins/blockquote/&lt;/a&gt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ Over the past 24 hours I&#39;ve been reflecting on my life &amp; I&#39;ve realized only one thing. I need a medieval battle axe.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;@allanbranch&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34; title=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34;&gt;twitter.com/allanbranch/status/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;h2 id=&#34;music&#34;&gt;music&lt;/h2&gt;
+
+ &lt;iframe style=&#34;max-width: 100%&#34;
+ class=&#34;music163&#34;
+ frameborder=&#34;no&#34;
+ border=&#34;0&#34;
+ marginwidth=&#34;0&#34;
+ marginheight=&#34;0&#34;
+ width=&#34;330&#34;
+ height=&#34;86&#34;
+ src=&#34;//music.163.com/outchain/player?type=2&amp;id=3950552&amp;auto=0&amp;height=66&#34;&gt;
+ &lt;/iframe&gt;
+
+&lt;h2 id=&#34;gist&#34;&gt;gist&lt;/h2&gt;
+
+&lt;p&gt;We can embed the gist in our content via username and gist ID pulled from the URL:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{&amp;lt; gist spf13 7896402 &amp;gt;}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Display:&lt;/p&gt;
+
+&lt;script src=&#34;//gist.github.com/spf13/7896402.js&#34;&gt;&lt;/script&gt;
+
+&lt;h2 id=&#34;youtube&#34;&gt;youtube&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//www.youtube.com/embed/w7Ft2ymGmfc&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; allowfullscreen frameborder=&#34;0&#34; title=&#34;YouTube Video&#34;&gt;&lt;/iframe&gt;
+ &lt;/div&gt;
+
+
+&lt;h2 id=&#34;vimeo&#34;&gt;vimeo&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//player.vimeo.com/video/146022717&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
+ &lt;/div&gt;</description>
+
</item>
<item>
@@ -62,11 +774,1101 @@ It makes use of a variety of open source projects including:
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/english-preview/</guid>
- <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or jane delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;</description>
+
</item>
<item>
@@ -75,8 +1877,1102 @@ It makes use of a variety of open source projects including:
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -85,8 +2981,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -95,12 +3329,87 @@ This document is a brief primer on using go templates.</description>
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -109,9 +3418,177 @@ Follow the following steps:
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -120,12 +3597,84 @@ Follow the following steps:
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/syntax-highlighting/</guid>
- <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+
+ <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
alert(&amp;quot;Hello, World!&amp;quot;)
}
&lt;/code&gt;&lt;/pre&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-kotlin&#34;&gt;package hello
+
+fun main(args: Array&amp;lt;String&amp;gt;) {
+ println(&amp;quot;Hello World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;#include &amp;lt;stdio.h&amp;gt;
+
+/* Hello */
+int main(void){
+ printf(&amp;quot;Hello, World!&amp;quot;);
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cpp&#34;&gt;// &#39;Hello World!&#39; program
+
+#include &amp;lt;iostream&amp;gt;
+
+int main(){
+ std::cout &amp;lt;&amp;lt; &amp;quot;Hello World!&amp;quot; &amp;lt;&amp;lt; std::endl;
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cs&#34;&gt;using System;
+class HelloWorld{
+ public static void Main(){
+ System.Console.WriteLine(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-html&#34;&gt;&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ Hello, World!
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main
+import fmt &amp;quot;fmt&amp;quot;
+
+func main()
+{
+ fmt.Printf(&amp;quot;Hello, World!\n&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-scala&#34;&gt;object HelloWorld with Application {
+ Console.println(&amp;quot;Hello, World!&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-php&#34;&gt;&amp;lt;?php
+ echo &#39;Hello, World!&#39;;
+?&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(&amp;quot;Hello, World!&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;</description>
+
</item>
</channel>
diff --git a/page/2/index.html b/page/2/index.html
index e2c6a3f..a231c81 100644
--- a/page/2/index.html
+++ b/page/2/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Jane - A simple theme for Hugo" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -248,15 +251,23 @@ Follow the following steps:
</section>
+
- <nav class="pagination">
-
- <a class="prev" href="/hugo-theme-jane/">
- <i class="iconfont icon-left"></i>
- <span class="prev-text">Prev</span>
- </a>
-
- </nav>
+
+
+<nav class="pagination">
+
+ <li >
+ <a href="/hugo-theme-jane/">1</a>
+ </li>
+
+ <li class="active" >
+ <a href="/hugo-theme-jane/page/2/">2</a>
+ </li>
+
+</nav>
+
+
</div>
</div>
@@ -314,5 +325,8 @@ Follow the following steps:
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/post/creating-a-new-theme/index.html b/post/creating-a-new-theme/index.html
index 9368ed2..5511fcb 100644
--- a/post/creating-a-new-theme/index.html
+++ b/post/creating-a-new-theme/index.html
@@ -47,6 +47,9 @@ We&amp;rsquo;ll start with creating a new site with a very basic template." />
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Creating a New Theme" />
<meta property="og:description" content="Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&rsquo;t cover using CSS to style your theme.
We&rsquo;ll start with creating a new site with a very basic template." />
@@ -1494,5 +1497,8 @@ $ vi themes/zafta/layouts/_default/single.html
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/post/english-preview/index.html b/post/english-preview/index.html
index 3e39682..5e2f1ab 100644
--- a/post/english-preview/index.html
+++ b/post/english-preview/index.html
@@ -48,6 +48,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="English Creating a New Theme" />
<meta property="og:description" content="Introduction
@@ -1497,5 +1500,8 @@ $ vi themes/zafta/layouts/_default/single.html
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/post/goisforlovers/index.html b/post/goisforlovers/index.html
index 70f4d01..8cdd400 100644
--- a/post/goisforlovers/index.html
+++ b/post/goisforlovers/index.html
@@ -47,6 +47,9 @@ This document is a brief primer on using go templates." />
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="(Hu)go Template Primer" />
<meta property="og:description" content="Hugo uses the excellent go html/template 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.
This document is a brief primer on using go templates." />
@@ -684,5 +687,8 @@ so, such as in this example:</p>
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/post/hugoisforlovers/index.html b/post/hugoisforlovers/index.html
index 2591d1b..03823cf 100644
--- a/post/hugoisforlovers/index.html
+++ b/post/hugoisforlovers/index.html
@@ -51,6 +51,9 @@ Follow the following steps:
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Getting Started with Hugo" />
<meta property="og:description" content="Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
Save it somewhere specific as we will be using it in the next step.
@@ -426,5 +429,8 @@ Having nearly instant feedback enables you to have your creativity flow without
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/post/index.html b/post/index.html
index 2bb21a6..50ef788 100644
--- a/post/index.html
+++ b/post/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Posts" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -258,10 +261,10 @@ ga('send', 'pageview');
</span>
</div></section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -319,5 +322,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/post/index.xml b/post/index.xml
index b7637fa..a5ce454 100644
--- a/post/index.xml
+++ b/post/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 06 Mar 2018 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/post/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/post/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,336 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/jane-theme-preview/</guid>
- <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
+
+ <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
&lt;p&gt;Please note that HTML fragments in markdown source will be recognized but not parsed or rendered. Also, there may be small reformatting on the original markdown source code after saving.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;paragraph-and-line-breaks&#34;&gt;Paragraph and line breaks&lt;/h2&gt;
+
+&lt;p&gt;A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by more than one blank lines. In Typora, you only need to press &lt;code&gt;Return&lt;/code&gt; to create a new paragraph.&lt;/p&gt;
+
+&lt;p&gt;Press &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Return&lt;/code&gt; to create a single line break. However, most markdown parser will ignore single line break, to make other markdown parsers recognize your line break, you can leave two whitespace at the end of the line, or insert &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;headers&#34;&gt;Headers&lt;/h2&gt;
+
+&lt;p&gt;Headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;# This is an H1
+
+## This is an H2
+
+###### This is an H6
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, input ‘#’s followed by title content, and press &lt;code&gt;Return&lt;/code&gt; key will create a header.&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Markdown uses email-style &amp;gt; characters for block quoting. They are presented as:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;This is a blockquote with two paragraphs. This is first paragraph.&lt;/p&gt;
+
+&lt;p&gt;This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.&lt;/p&gt;
+
+&lt;p&gt;This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;In typora, just input ‘&amp;gt;’ followed by quote contents a block quote is generated. Typora will insert proper ‘&amp;gt;’ or line break for you. Block quote inside anther block quote is allowed by adding additional levels of ‘&amp;gt;’.&lt;/p&gt;
+
+&lt;h2 id=&#34;lists&#34;&gt;Lists&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;* list item 1&lt;/code&gt; will create an un-ordered list, the &lt;code&gt;*&lt;/code&gt; symbol can be replace with &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;1. list item 1&lt;/code&gt; will create an ordered list, their markdown source code is like:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;task-list&#34;&gt;Task List&lt;/h2&gt;
+
+&lt;p&gt;Task lists are lists with items marked as either [ ] or &lt;a href=&#34;incomplete or complete&#34;&gt;x&lt;/a&gt;. For example:&lt;/p&gt;
+
+&lt;ul class=&#34;task-list&#34;&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; a task list item&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; list syntax required&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; normal &lt;strong&gt;formatting&lt;/strong&gt;, @mentions, #1234 refs&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; incomplete&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; checked disabled class=&#34;task-list-item&#34;&gt; completed&lt;/label&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;You can change the complete/incomplete state by click the checkbox before the item.&lt;/p&gt;
+
+&lt;h2 id=&#34;syntax-highlighting&#34;&gt;Syntax Highlighting&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+ alert(&amp;quot;Hello, World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;math-blocks&#34;&gt;Math Blocks&lt;/h2&gt;
+
+&lt;p&gt;You can render *LaTeX* mathematical expressions using &lt;strong&gt;MathJax&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;$$&lt;/code&gt;, then press &amp;lsquo;Return&amp;rsquo; key will trigger an input field which accept &lt;em&gt;Tex/LaTex&lt;/em&gt; source. Following is an example:
+$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} &lt;br /&gt;
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 &lt;br /&gt;
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 &lt;br /&gt;
+\end{vmatrix}
+$$&lt;/p&gt;
+
+&lt;p&gt;In markdown source file, math block is &lt;em&gt;LaTeX&lt;/em&gt; expression wrapped by ‘$$’ mark:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} \\
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 \\
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 \\
+\end{vmatrix}
+$$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;tables&#34;&gt;Tables&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;| First Header | Second Header |&lt;/code&gt; and press &lt;code&gt;return&lt;/code&gt; key will create a table with two column.&lt;/p&gt;
+
+&lt;p&gt;After table is created, focus on that table will pop up a toolbar for table, where you can resize, align, or delete table. You can also use context menu to copy and add/delete column/row.&lt;/p&gt;
+
+&lt;p&gt;Following descriptions can be skipped, as markdown source code for tables are generated by typora automatically.&lt;/p&gt;
+
+&lt;p&gt;In markdown source code, they look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;| First Header | Second Header |
+| ------------- | ------------- |
+| Content Cell | Content Cell |
+| Content Cell | Content Cell |
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+&lt;tr&gt;
+&lt;th&gt;First Header&lt;/th&gt;
+&lt;th&gt;Second Header&lt;/th&gt;
+&lt;/tr&gt;
+&lt;/thead&gt;
+
+&lt;tbody&gt;
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h2 id=&#34;footnotes&#34;&gt;Footnotes&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;You can create footnotes like this[^footnote].
+
+[^footnote]: Here is the *text* of the **footnote**.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;You can create footnotes like this&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:footnote&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:footnote&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
+
+&lt;p&gt;Mouse on the ‘footnote’ superscript to see content of the footnote.&lt;/p&gt;
+
+&lt;h2 id=&#34;horizontal-rules&#34;&gt;Horizontal Rules&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;***&lt;/code&gt; or &lt;code&gt;---&lt;/code&gt; on a blank line and press &lt;code&gt;return&lt;/code&gt; will draw a horizontal line.&lt;/p&gt;
+
+&lt;hr /&gt;
+
+&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
+
+&lt;p&gt;Markdown supports two style of links: inline and reference.&lt;/p&gt;
+
+&lt;p&gt;In both styles, the link text is delimited by [square brackets].&lt;/p&gt;
+
+&lt;p&gt;To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example](http://example.com/ &amp;quot;Title&amp;quot;) inline link.
+
+[This link](http://example.net/) has no title attribute.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Title&#34;&gt;an example&lt;/a&gt; inline link. (&lt;code&gt;&amp;lt;p&amp;gt;This is &amp;lt;a href=&amp;quot;http://example.com/&amp;quot; title=&amp;quot;Title&amp;quot;&amp;gt;&lt;/code&gt;)&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://example.net/&#34;&gt;This link&lt;/a&gt; has no title attribute. (&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://example.net/&amp;quot;&amp;gt;This link&amp;lt;/a&amp;gt; has no&lt;/code&gt;)&lt;/p&gt;
+
+&lt;h3 id=&#34;internal-links&#34;&gt;Internal Links&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;You can set the href to headers&lt;/strong&gt;, which will create a bookmark that allow you to jump to that section after clicking. For example:&lt;/p&gt;
+
+&lt;p&gt;Command(on Windows: Ctrl) + Click &lt;a href=&#34;#block-elements&#34;&gt;This link&lt;/a&gt; will jump to header &lt;code&gt;Block Elements&lt;/code&gt;. To see how to write that, please move cursor or click that link with &lt;code&gt;⌘&lt;/code&gt; key pressed to expand the element into markdown source.&lt;/p&gt;
+
+&lt;h3 id=&#34;reference-links&#34;&gt;Reference Links&lt;/h3&gt;
+
+&lt;p&gt;Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example][id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this, on a line by itself:
+
+[id]: http://example.com/ &amp;quot;Optional Title Here&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, they will be rendered like:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Optional Title Here&#34;&gt;an example&lt;/a&gt; reference-style link.&lt;/p&gt;
+
+&lt;p&gt;The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;[Google][]
+And then define the link:
+
+[Google]: http://google.com/
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora click link will expand it for editing, command+click will open the hyperlink in web browser.&lt;/p&gt;
+
+&lt;h2 id=&#34;urls&#34;&gt;URLs&lt;/h2&gt;
+
+&lt;p&gt;Typora allows you to insert urls as links, wrapped by &lt;code&gt;&amp;lt;&lt;/code&gt;brackets&lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;i@typora.io&amp;gt;&lt;/code&gt; becomes &lt;a href=&#34;mailto:i@typora.io&#34;&gt;i@typora.io&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Typora will aslo auto link standard URLs. e.g: www.google.com.&lt;/p&gt;
+
+&lt;h2 id=&#34;images&#34;&gt;Images&lt;/h2&gt;
+
+&lt;p&gt;Image looks similar with links, but it requires an additional &lt;code&gt;!&lt;/code&gt; char before the start of link. Image syntax looks like this:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg &amp;quot;Optional title&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;You are able to use drag &amp;amp; drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag &amp;amp; drop.&lt;/p&gt;
+
+&lt;p&gt;For more tips on images, please read &lt;a href=&#34;http://support.typora.io//Images/&#34;&gt;http://support.typora.io//Images/&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;emphasis&#34;&gt;Emphasis&lt;/h2&gt;
+
+&lt;p&gt;Markdown treats asterisks (&lt;code&gt;*&lt;/code&gt;) and underscores (&lt;code&gt;_&lt;/code&gt;) as indicators of emphasis. Text wrapped with one &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt; will be wrapped with an HTML &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag. E.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;*single asterisks*
+
+_single underscores_
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single asterisks&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single underscores&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;GFM will ignores underscores in words, which is commonly used in code and names, like this:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;wow_great_stuff&lt;/p&gt;
+
+&lt;p&gt;do_this_and_do_that_and_another_thing.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;\*this text is surrounded by literal asterisks\*
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;*&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;strong&#34;&gt;Strong&lt;/h2&gt;
+
+&lt;p&gt;double *’s or _’s will be wrapped with an HTML &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag, e.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;**double asterisks**
+
+__double underscores__
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double asterisks&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double underscores&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;**&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
+
+&lt;p&gt;To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;Use the `printf()` function.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
+
+&lt;h2 id=&#34;strikethrough&#34;&gt;Strikethrough&lt;/h2&gt;
+
+&lt;p&gt;GFM adds syntax to create strikethrough text, which is missing from standard Markdown.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;~~Mistaken text.~~&lt;/code&gt; becomes &lt;del&gt;Mistaken text.&lt;/del&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;underline&#34;&gt;Underline&lt;/h2&gt;
+
+&lt;p&gt;Underline is powered by raw HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;u&amp;gt;Underline&amp;lt;/u&amp;gt;&lt;/code&gt; becomes &lt;u&gt;Underline&lt;/u&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;emoji-happy&#34;&gt;Emoji :happy:&lt;/h2&gt;
+
+&lt;p&gt;Input emoji with syntax &lt;code&gt;😄&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;User can trigger auto-complete suggestions for emoji by pressing &lt;code&gt;ESC&lt;/code&gt; key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from &lt;code&gt;Edit&lt;/code&gt; -&amp;gt; &lt;code&gt;Emoji &amp;amp; Symbols&lt;/code&gt; from menu bar is also supported.&lt;/p&gt;
+
+&lt;h2 id=&#34;inline-math&#34;&gt;Inline Math&lt;/h2&gt;
+
+&lt;p&gt;To use this feature, first, please enable it in &lt;code&gt;Preference&lt;/code&gt; Panel -&amp;gt; &lt;code&gt;Markdown&lt;/code&gt; Tab. Then use &lt;code&gt;$&lt;/code&gt; to wrap TeX command, for example: &lt;code&gt;$\lim_{x \to \infty} \exp(-x) = 0$&lt;/code&gt; will be rendered as LaTeX command.&lt;/p&gt;
+
+&lt;p&gt;To trigger inline preview for inline math: input “$”, then press &lt;code&gt;ESC&lt;/code&gt; key, then input TeX command, a preview tooltip will be visible like below:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;http://typora.io/img/inline-math.gif&#34; style=&#34;zoom:50%;&#34; /&gt;&lt;/p&gt;
+&lt;div class=&#34;footnotes&#34;&gt;
+
+&lt;hr /&gt;
+
+&lt;ol&gt;
+&lt;li id=&#34;fn:footnote&#34;&gt;Here is the &lt;em&gt;text&lt;/em&gt; of the &lt;strong&gt;footnote&lt;/strong&gt;.
+ &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:footnote&#34;&gt;&lt;sup&gt;[return]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
+&lt;/ol&gt;
+&lt;/div&gt;</description>
+
</item>
<item>
@@ -30,7 +355,8 @@
<pubDate>Sun, 04 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/shortcodes-preview/</guid>
- <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
&lt;p&gt;Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video &lt;code&gt;&amp;lt;iframes&amp;gt;&lt;/code&gt;) to Markdown content. We think this contradicts the beautiful simplicity of Markdown&amp;rsquo;s syntax.&lt;/p&gt;
@@ -42,7 +368,381 @@
&lt;p&gt;More details: &lt;a href=&#34;https://gohugo.io/content-management/shortcodes/&#34;&gt;https://gohugo.io/content-management/shortcodes/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Normal quote:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a simple quote.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote with only an Author named Author2.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author2&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author3 and source &#34;source.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author3&lt;/strong&gt;
+
+ &lt;cite&gt;Source&lt;/cite&gt;
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and link:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author4 and links to https://www.google.com.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author4&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;google.com&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author, link and title:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://www.google.com with title &#34;Google.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author5&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;Google&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and a link longer than 32 characters, string is first cut at 32 characters then everything after the last forward slash is removed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://twitter.com/CryptoGangsta/status/716427930126196737 which is longer than 32 characters.
+ &lt;br&gt;And this is a new line in the quote with the HTML br tag.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author6&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34; title=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34;&gt;twitter.com/CryptoGangsta/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Test from the Octopress blockquote page at: &lt;a href=&#34;http://octopress.org/docs/plugins/blockquote/&#34;&gt;http://octopress.org/docs/plugins/blockquote/&lt;/a&gt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ Over the past 24 hours I&#39;ve been reflecting on my life &amp; I&#39;ve realized only one thing. I need a medieval battle axe.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;@allanbranch&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34; title=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34;&gt;twitter.com/allanbranch/status/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;h2 id=&#34;music&#34;&gt;music&lt;/h2&gt;
+
+ &lt;iframe style=&#34;max-width: 100%&#34;
+ class=&#34;music163&#34;
+ frameborder=&#34;no&#34;
+ border=&#34;0&#34;
+ marginwidth=&#34;0&#34;
+ marginheight=&#34;0&#34;
+ width=&#34;330&#34;
+ height=&#34;86&#34;
+ src=&#34;//music.163.com/outchain/player?type=2&amp;id=3950552&amp;auto=0&amp;height=66&#34;&gt;
+ &lt;/iframe&gt;
+
+&lt;h2 id=&#34;gist&#34;&gt;gist&lt;/h2&gt;
+
+&lt;p&gt;We can embed the gist in our content via username and gist ID pulled from the URL:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{&amp;lt; gist spf13 7896402 &amp;gt;}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Display:&lt;/p&gt;
+
+&lt;script src=&#34;//gist.github.com/spf13/7896402.js&#34;&gt;&lt;/script&gt;
+
+&lt;h2 id=&#34;youtube&#34;&gt;youtube&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//www.youtube.com/embed/w7Ft2ymGmfc&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; allowfullscreen frameborder=&#34;0&#34; title=&#34;YouTube Video&#34;&gt;&lt;/iframe&gt;
+ &lt;/div&gt;
+
+
+&lt;h2 id=&#34;vimeo&#34;&gt;vimeo&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//player.vimeo.com/video/146022717&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
+ &lt;/div&gt;</description>
+
</item>
<item>
@@ -51,11 +751,1101 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/english-preview/</guid>
- <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or jane delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;</description>
+
</item>
<item>
@@ -64,8 +1854,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -74,8 +2958,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -84,12 +3306,87 @@ This document is a brief primer on using go templates.</description>
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -98,9 +3395,177 @@ Follow the following steps:
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -109,12 +3574,84 @@ Follow the following steps:
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/syntax-highlighting/</guid>
- <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+
+ <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
alert(&amp;quot;Hello, World!&amp;quot;)
}
&lt;/code&gt;&lt;/pre&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-kotlin&#34;&gt;package hello
+
+fun main(args: Array&amp;lt;String&amp;gt;) {
+ println(&amp;quot;Hello World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;#include &amp;lt;stdio.h&amp;gt;
+
+/* Hello */
+int main(void){
+ printf(&amp;quot;Hello, World!&amp;quot;);
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cpp&#34;&gt;// &#39;Hello World!&#39; program
+
+#include &amp;lt;iostream&amp;gt;
+
+int main(){
+ std::cout &amp;lt;&amp;lt; &amp;quot;Hello World!&amp;quot; &amp;lt;&amp;lt; std::endl;
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cs&#34;&gt;using System;
+class HelloWorld{
+ public static void Main(){
+ System.Console.WriteLine(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-html&#34;&gt;&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ Hello, World!
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main
+import fmt &amp;quot;fmt&amp;quot;
+
+func main()
+{
+ fmt.Printf(&amp;quot;Hello, World!\n&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-scala&#34;&gt;object HelloWorld with Application {
+ Console.println(&amp;quot;Hello, World!&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-php&#34;&gt;&amp;lt;?php
+ echo &#39;Hello, World!&#39;;
+?&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(&amp;quot;Hello, World!&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;</description>
+
</item>
</channel>
diff --git a/post/jane-theme-preview/index.html b/post/jane-theme-preview/index.html
index bf5d029..3cba5d7 100644
--- a/post/jane-theme-preview/index.html
+++ b/post/jane-theme-preview/index.html
@@ -49,6 +49,9 @@ Please note that HTML fragments in markdown source will be recognized but not pa
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Jane Theme Preview" />
<meta property="og:description" content="Markdown is created by Daring Fireball, the original guideline is here. Its syntax, however, varies between different parsers or editors.
@@ -688,5 +691,8 @@ __double underscores__
<script async src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'></script>
+
+
+
</body>
</html>
diff --git a/post/migrate-from-jekyll/index.html b/post/migrate-from-jekyll/index.html
index cc28158..3472f28 100644
--- a/post/migrate-from-jekyll/index.html
+++ b/post/migrate-from-jekyll/index.html
@@ -48,6 +48,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Migrate to Hugo from Jekyll" />
<meta property="og:description" content="Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
▾ &lt;root&gt;/ ▾ images/ logo.png should become
@@ -519,5 +522,8 @@ Liquid::Template.register_tag('image', Jekyll::ImageTag)
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/post/shortcodes-preview/index.html b/post/shortcodes-preview/index.html
index 2487b9a..48cc079 100644
--- a/post/shortcodes-preview/index.html
+++ b/post/shortcodes-preview/index.html
@@ -52,6 +52,9 @@ More details: https://gohugo.io/content-management/shortcodes/
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Shortcodes Preview" />
<meta property="og:description" content="What a Shortcode is
@@ -753,5 +756,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/post/syntax-highlighting/index.html b/post/syntax-highlighting/index.html
index 209fc1c..d1e01d9 100644
--- a/post/syntax-highlighting/index.html
+++ b/post/syntax-highlighting/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Syntax Highlighting" />
<meta property="og:description" content="function helloWorld () {
alert(&quot;Hello, World!&quot;)
@@ -393,5 +396,8 @@ func main()
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/development/index.html b/tags/development/index.html
index 60b7acb..e0624df 100644
--- a/tags/development/index.html
+++ b/tags/development/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Development" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -200,10 +203,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -261,5 +264,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/development/index.xml b/tags/development/index.xml
index 08905ea..ad63492 100644
--- a/tags/development/index.xml
+++ b/tags/development/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/development/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/development/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,8 +17,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -27,8 +1121,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -37,12 +1469,87 @@ This document is a brief primer on using go templates.</description>
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -51,9 +1558,177 @@ Follow the following steps:
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
</channel>
diff --git a/tags/english/index.html b/tags/english/index.html
index d216901..af3bca8 100644
--- a/tags/english/index.html
+++ b/tags/english/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="English" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -167,10 +170,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -228,5 +231,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/english/index.xml b/tags/english/index.xml
index 80ae39b..43301c3 100644
--- a/tags/english/index.xml
+++ b/tags/english/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Thu, 31 Aug 2017 15:43:48 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/english/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/english/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,1101 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/english-preview/</guid>
- <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or jane delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;</description>
+
</item>
</channel>
diff --git a/tags/go/index.html b/tags/go/index.html
index 0d9464f..c130016 100644
--- a/tags/go/index.html
+++ b/tags/go/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Go" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -200,10 +203,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -261,5 +264,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/go/index.xml b/tags/go/index.xml
index aecf102..914b7b5 100644
--- a/tags/go/index.xml
+++ b/tags/go/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/go/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/go/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,8 +17,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -27,8 +1121,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -37,12 +1469,87 @@ This document is a brief primer on using go templates.</description>
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -51,9 +1558,177 @@ Follow the following steps:
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
</channel>
diff --git a/tags/golang/index.html b/tags/golang/index.html
index fbdea5e..89a6eae 100644
--- a/tags/golang/index.html
+++ b/tags/golang/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Golang" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -200,10 +203,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -261,5 +264,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/golang/index.xml b/tags/golang/index.xml
index 3188374..a5a0698 100644
--- a/tags/golang/index.xml
+++ b/tags/golang/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/golang/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/golang/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,8 +17,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -27,8 +1121,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -37,12 +1469,87 @@ This document is a brief primer on using go templates.</description>
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -51,9 +1558,177 @@ Follow the following steps:
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
</channel>
diff --git a/tags/hugo/index.html b/tags/hugo/index.html
index 1d1cf52..dce6543 100644
--- a/tags/hugo/index.html
+++ b/tags/hugo/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Hugo" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -167,10 +170,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -228,5 +231,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/hugo/index.xml b/tags/hugo/index.xml
index eae3901..a15bf8e 100644
--- a/tags/hugo/index.xml
+++ b/tags/hugo/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Wed, 02 Apr 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/hugo/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/hugo/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,12 +17,87 @@
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/hugoisforlovers/</guid>
- <description>Step 1. Install Hugo Goto hugo releases and download the appropriate version for your os and architecture.
-Save it somewhere specific as we will be using it in the next step.
-More complete instructions are available at installing hugo
-Step 2. Build the Docs Hugo has its own example site which happens to also be the documentation site you are reading right now.
-Follow the following steps:
- Clone the hugo repository Go into the repo Run hugo in server mode and build the docs Open your browser to http://localhost:1313 Corresponding pseudo commands:</description>
+
+ <description>
+
+&lt;h2 id=&#34;step-1-install-hugo&#34;&gt;Step 1. Install Hugo&lt;/h2&gt;
+
+&lt;p&gt;Goto &lt;a href=&#34;https://github.com/spf13/hugo/releases&#34;&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=&#34;http://en.xianmin.org/hugo-theme-jane/overview/installing/&#34;&gt;installing hugo&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;step-2-build-the-docs&#34;&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=&#34;http://github.com/spf13/hugo&#34;&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 &lt;a href=&#34;http://localhost:1313&#34;&gt;http://localhost:1313&lt;/a&gt;&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=&#34;step-3-change-the-docs-site&#34;&gt;Step 3. Change the docs site&lt;/h2&gt;
+
+&lt;p&gt;Stop the Hugo process by hitting ctrl+c.&lt;/p&gt;
+
+&lt;p&gt;Now we are going to run hugo again, but this time with hugo in watch mode.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;/path/to/hugo/from/step/1/hugo server --source=./docs --watch
+&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; Watching for changes in /Users/spf13/Code/hugo/docs/content
+&amp;gt; Press ctrl+c to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Open your &lt;a href=&#34;http://vim.spf13.com&#34;&gt;favorite editor&lt;/a&gt; and change one of the source
+content pages. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;. How about changing this very file to &lt;em&gt;fix the typo&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Content files are found in &lt;code&gt;docs/content/&lt;/code&gt;. Unless otherwise specified, files
+are located at the same relative location as the url, in our case
+&lt;code&gt;docs/content/overview/quickstart.md&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Change and save this file.. Notice what happened in your terminal.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;gt; Change detected, rebuilding site
+
+&amp;gt; 29 pages created
+&amp;gt; 0 tags index created
+&amp;gt; in 26 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Refresh the browser and observe that the typo is now fixed.&lt;/p&gt;
+
+&lt;p&gt;Notice how quick that was. Try to refresh the site before it&amp;rsquo;s finished building.. I double dare you.
+Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.&lt;/p&gt;
+
+&lt;h2 id=&#34;step-4-have-fun&#34;&gt;Step 4. Have fun&lt;/h2&gt;
+
+&lt;p&gt;The best way to learn something is to play with it.&lt;/p&gt;
+</description>
+
</item>
</channel>
diff --git a/tags/index.html b/tags/index.html
index 33302fe..2d1f895 100644
--- a/tags/index.html
+++ b/tags/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Tags" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -333,5 +336,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/index.xml b/tags/index.xml
index 636a69d..fe8f55b 100644
--- a/tags/index.xml
+++ b/tags/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,7 +17,9 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/development/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -26,7 +28,9 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/english/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -35,7 +39,9 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/go/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -44,7 +50,9 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/golang/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -53,7 +61,9 @@
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/hugo/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -62,7 +72,9 @@
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/jekyll/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -71,7 +83,9 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/preview/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -80,7 +94,9 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/shortcodes/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -89,7 +105,9 @@
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/syntax-highlighting/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -98,7 +116,9 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/tag-2/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -107,7 +127,9 @@
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/tag-5/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -116,7 +138,9 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/tag-6/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -125,7 +149,9 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/templates/</guid>
- <description></description>
+
+ <description></description>
+
</item>
<item>
@@ -134,7 +160,9 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/tags/themes/</guid>
- <description></description>
+
+ <description></description>
+
</item>
</channel>
diff --git a/tags/jekyll/index.html b/tags/jekyll/index.html
index 2b7cbae..18d7d21 100644
--- a/tags/jekyll/index.html
+++ b/tags/jekyll/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Jekyll" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -167,10 +170,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -228,5 +231,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/jekyll/index.xml b/tags/jekyll/index.xml
index c25073a..6aff323 100644
--- a/tags/jekyll/index.xml
+++ b/tags/jekyll/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Mon, 10 Mar 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/jekyll/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/jekyll/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,9 +17,177 @@
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
</channel>
diff --git a/tags/preview/index.html b/tags/preview/index.html
index 2230480..f47354a 100644
--- a/tags/preview/index.html
+++ b/tags/preview/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Preview" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -200,10 +203,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -261,5 +264,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/preview/index.xml b/tags/preview/index.xml
index c610a40..0fa300c 100644
--- a/tags/preview/index.xml
+++ b/tags/preview/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 06 Mar 2018 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/preview/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/preview/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,336 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/jane-theme-preview/</guid>
- <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
+
+ <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
&lt;p&gt;Please note that HTML fragments in markdown source will be recognized but not parsed or rendered. Also, there may be small reformatting on the original markdown source code after saving.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;paragraph-and-line-breaks&#34;&gt;Paragraph and line breaks&lt;/h2&gt;
+
+&lt;p&gt;A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by more than one blank lines. In Typora, you only need to press &lt;code&gt;Return&lt;/code&gt; to create a new paragraph.&lt;/p&gt;
+
+&lt;p&gt;Press &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Return&lt;/code&gt; to create a single line break. However, most markdown parser will ignore single line break, to make other markdown parsers recognize your line break, you can leave two whitespace at the end of the line, or insert &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;headers&#34;&gt;Headers&lt;/h2&gt;
+
+&lt;p&gt;Headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;# This is an H1
+
+## This is an H2
+
+###### This is an H6
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, input ‘#’s followed by title content, and press &lt;code&gt;Return&lt;/code&gt; key will create a header.&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Markdown uses email-style &amp;gt; characters for block quoting. They are presented as:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;This is a blockquote with two paragraphs. This is first paragraph.&lt;/p&gt;
+
+&lt;p&gt;This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.&lt;/p&gt;
+
+&lt;p&gt;This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;In typora, just input ‘&amp;gt;’ followed by quote contents a block quote is generated. Typora will insert proper ‘&amp;gt;’ or line break for you. Block quote inside anther block quote is allowed by adding additional levels of ‘&amp;gt;’.&lt;/p&gt;
+
+&lt;h2 id=&#34;lists&#34;&gt;Lists&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;* list item 1&lt;/code&gt; will create an un-ordered list, the &lt;code&gt;*&lt;/code&gt; symbol can be replace with &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;1. list item 1&lt;/code&gt; will create an ordered list, their markdown source code is like:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;task-list&#34;&gt;Task List&lt;/h2&gt;
+
+&lt;p&gt;Task lists are lists with items marked as either [ ] or &lt;a href=&#34;incomplete or complete&#34;&gt;x&lt;/a&gt;. For example:&lt;/p&gt;
+
+&lt;ul class=&#34;task-list&#34;&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; a task list item&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; list syntax required&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; normal &lt;strong&gt;formatting&lt;/strong&gt;, @mentions, #1234 refs&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; incomplete&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; checked disabled class=&#34;task-list-item&#34;&gt; completed&lt;/label&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;You can change the complete/incomplete state by click the checkbox before the item.&lt;/p&gt;
+
+&lt;h2 id=&#34;syntax-highlighting&#34;&gt;Syntax Highlighting&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+ alert(&amp;quot;Hello, World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;math-blocks&#34;&gt;Math Blocks&lt;/h2&gt;
+
+&lt;p&gt;You can render *LaTeX* mathematical expressions using &lt;strong&gt;MathJax&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;$$&lt;/code&gt;, then press &amp;lsquo;Return&amp;rsquo; key will trigger an input field which accept &lt;em&gt;Tex/LaTex&lt;/em&gt; source. Following is an example:
+$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} &lt;br /&gt;
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 &lt;br /&gt;
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 &lt;br /&gt;
+\end{vmatrix}
+$$&lt;/p&gt;
+
+&lt;p&gt;In markdown source file, math block is &lt;em&gt;LaTeX&lt;/em&gt; expression wrapped by ‘$$’ mark:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} \\
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 \\
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 \\
+\end{vmatrix}
+$$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;tables&#34;&gt;Tables&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;| First Header | Second Header |&lt;/code&gt; and press &lt;code&gt;return&lt;/code&gt; key will create a table with two column.&lt;/p&gt;
+
+&lt;p&gt;After table is created, focus on that table will pop up a toolbar for table, where you can resize, align, or delete table. You can also use context menu to copy and add/delete column/row.&lt;/p&gt;
+
+&lt;p&gt;Following descriptions can be skipped, as markdown source code for tables are generated by typora automatically.&lt;/p&gt;
+
+&lt;p&gt;In markdown source code, they look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;| First Header | Second Header |
+| ------------- | ------------- |
+| Content Cell | Content Cell |
+| Content Cell | Content Cell |
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+&lt;tr&gt;
+&lt;th&gt;First Header&lt;/th&gt;
+&lt;th&gt;Second Header&lt;/th&gt;
+&lt;/tr&gt;
+&lt;/thead&gt;
+
+&lt;tbody&gt;
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h2 id=&#34;footnotes&#34;&gt;Footnotes&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;You can create footnotes like this[^footnote].
+
+[^footnote]: Here is the *text* of the **footnote**.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;You can create footnotes like this&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:footnote&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:footnote&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
+
+&lt;p&gt;Mouse on the ‘footnote’ superscript to see content of the footnote.&lt;/p&gt;
+
+&lt;h2 id=&#34;horizontal-rules&#34;&gt;Horizontal Rules&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;***&lt;/code&gt; or &lt;code&gt;---&lt;/code&gt; on a blank line and press &lt;code&gt;return&lt;/code&gt; will draw a horizontal line.&lt;/p&gt;
+
+&lt;hr /&gt;
+
+&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
+
+&lt;p&gt;Markdown supports two style of links: inline and reference.&lt;/p&gt;
+
+&lt;p&gt;In both styles, the link text is delimited by [square brackets].&lt;/p&gt;
+
+&lt;p&gt;To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example](http://example.com/ &amp;quot;Title&amp;quot;) inline link.
+
+[This link](http://example.net/) has no title attribute.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Title&#34;&gt;an example&lt;/a&gt; inline link. (&lt;code&gt;&amp;lt;p&amp;gt;This is &amp;lt;a href=&amp;quot;http://example.com/&amp;quot; title=&amp;quot;Title&amp;quot;&amp;gt;&lt;/code&gt;)&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://example.net/&#34;&gt;This link&lt;/a&gt; has no title attribute. (&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://example.net/&amp;quot;&amp;gt;This link&amp;lt;/a&amp;gt; has no&lt;/code&gt;)&lt;/p&gt;
+
+&lt;h3 id=&#34;internal-links&#34;&gt;Internal Links&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;You can set the href to headers&lt;/strong&gt;, which will create a bookmark that allow you to jump to that section after clicking. For example:&lt;/p&gt;
+
+&lt;p&gt;Command(on Windows: Ctrl) + Click &lt;a href=&#34;#block-elements&#34;&gt;This link&lt;/a&gt; will jump to header &lt;code&gt;Block Elements&lt;/code&gt;. To see how to write that, please move cursor or click that link with &lt;code&gt;⌘&lt;/code&gt; key pressed to expand the element into markdown source.&lt;/p&gt;
+
+&lt;h3 id=&#34;reference-links&#34;&gt;Reference Links&lt;/h3&gt;
+
+&lt;p&gt;Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example][id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this, on a line by itself:
+
+[id]: http://example.com/ &amp;quot;Optional Title Here&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, they will be rendered like:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Optional Title Here&#34;&gt;an example&lt;/a&gt; reference-style link.&lt;/p&gt;
+
+&lt;p&gt;The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;[Google][]
+And then define the link:
+
+[Google]: http://google.com/
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora click link will expand it for editing, command+click will open the hyperlink in web browser.&lt;/p&gt;
+
+&lt;h2 id=&#34;urls&#34;&gt;URLs&lt;/h2&gt;
+
+&lt;p&gt;Typora allows you to insert urls as links, wrapped by &lt;code&gt;&amp;lt;&lt;/code&gt;brackets&lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;i@typora.io&amp;gt;&lt;/code&gt; becomes &lt;a href=&#34;mailto:i@typora.io&#34;&gt;i@typora.io&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Typora will aslo auto link standard URLs. e.g: www.google.com.&lt;/p&gt;
+
+&lt;h2 id=&#34;images&#34;&gt;Images&lt;/h2&gt;
+
+&lt;p&gt;Image looks similar with links, but it requires an additional &lt;code&gt;!&lt;/code&gt; char before the start of link. Image syntax looks like this:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg &amp;quot;Optional title&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;You are able to use drag &amp;amp; drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag &amp;amp; drop.&lt;/p&gt;
+
+&lt;p&gt;For more tips on images, please read &lt;a href=&#34;http://support.typora.io//Images/&#34;&gt;http://support.typora.io//Images/&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;emphasis&#34;&gt;Emphasis&lt;/h2&gt;
+
+&lt;p&gt;Markdown treats asterisks (&lt;code&gt;*&lt;/code&gt;) and underscores (&lt;code&gt;_&lt;/code&gt;) as indicators of emphasis. Text wrapped with one &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt; will be wrapped with an HTML &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag. E.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;*single asterisks*
+
+_single underscores_
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single asterisks&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single underscores&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;GFM will ignores underscores in words, which is commonly used in code and names, like this:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;wow_great_stuff&lt;/p&gt;
+
+&lt;p&gt;do_this_and_do_that_and_another_thing.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;\*this text is surrounded by literal asterisks\*
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;*&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;strong&#34;&gt;Strong&lt;/h2&gt;
+
+&lt;p&gt;double *’s or _’s will be wrapped with an HTML &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag, e.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;**double asterisks**
+
+__double underscores__
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double asterisks&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double underscores&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;**&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
+
+&lt;p&gt;To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;Use the `printf()` function.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
+
+&lt;h2 id=&#34;strikethrough&#34;&gt;Strikethrough&lt;/h2&gt;
+
+&lt;p&gt;GFM adds syntax to create strikethrough text, which is missing from standard Markdown.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;~~Mistaken text.~~&lt;/code&gt; becomes &lt;del&gt;Mistaken text.&lt;/del&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;underline&#34;&gt;Underline&lt;/h2&gt;
+
+&lt;p&gt;Underline is powered by raw HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;u&amp;gt;Underline&amp;lt;/u&amp;gt;&lt;/code&gt; becomes &lt;u&gt;Underline&lt;/u&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;emoji-happy&#34;&gt;Emoji :happy:&lt;/h2&gt;
+
+&lt;p&gt;Input emoji with syntax &lt;code&gt;😄&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;User can trigger auto-complete suggestions for emoji by pressing &lt;code&gt;ESC&lt;/code&gt; key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from &lt;code&gt;Edit&lt;/code&gt; -&amp;gt; &lt;code&gt;Emoji &amp;amp; Symbols&lt;/code&gt; from menu bar is also supported.&lt;/p&gt;
+
+&lt;h2 id=&#34;inline-math&#34;&gt;Inline Math&lt;/h2&gt;
+
+&lt;p&gt;To use this feature, first, please enable it in &lt;code&gt;Preference&lt;/code&gt; Panel -&amp;gt; &lt;code&gt;Markdown&lt;/code&gt; Tab. Then use &lt;code&gt;$&lt;/code&gt; to wrap TeX command, for example: &lt;code&gt;$\lim_{x \to \infty} \exp(-x) = 0$&lt;/code&gt; will be rendered as LaTeX command.&lt;/p&gt;
+
+&lt;p&gt;To trigger inline preview for inline math: input “$”, then press &lt;code&gt;ESC&lt;/code&gt; key, then input TeX command, a preview tooltip will be visible like below:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;http://typora.io/img/inline-math.gif&#34; style=&#34;zoom:50%;&#34; /&gt;&lt;/p&gt;
+&lt;div class=&#34;footnotes&#34;&gt;
+
+&lt;hr /&gt;
+
+&lt;ol&gt;
+&lt;li id=&#34;fn:footnote&#34;&gt;Here is the &lt;em&gt;text&lt;/em&gt; of the &lt;strong&gt;footnote&lt;/strong&gt;.
+ &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:footnote&#34;&gt;&lt;sup&gt;[return]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
+&lt;/ol&gt;
+&lt;/div&gt;</description>
+
</item>
<item>
@@ -30,7 +355,8 @@
<pubDate>Sun, 04 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/shortcodes-preview/</guid>
- <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
&lt;p&gt;Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video &lt;code&gt;&amp;lt;iframes&amp;gt;&lt;/code&gt;) to Markdown content. We think this contradicts the beautiful simplicity of Markdown&amp;rsquo;s syntax.&lt;/p&gt;
@@ -42,7 +368,381 @@
&lt;p&gt;More details: &lt;a href=&#34;https://gohugo.io/content-management/shortcodes/&#34;&gt;https://gohugo.io/content-management/shortcodes/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Normal quote:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a simple quote.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote with only an Author named Author2.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author2&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author3 and source &#34;source.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author3&lt;/strong&gt;
+
+ &lt;cite&gt;Source&lt;/cite&gt;
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and link:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author4 and links to https://www.google.com.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author4&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;google.com&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author, link and title:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://www.google.com with title &#34;Google.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author5&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;Google&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and a link longer than 32 characters, string is first cut at 32 characters then everything after the last forward slash is removed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://twitter.com/CryptoGangsta/status/716427930126196737 which is longer than 32 characters.
+ &lt;br&gt;And this is a new line in the quote with the HTML br tag.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author6&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34; title=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34;&gt;twitter.com/CryptoGangsta/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Test from the Octopress blockquote page at: &lt;a href=&#34;http://octopress.org/docs/plugins/blockquote/&#34;&gt;http://octopress.org/docs/plugins/blockquote/&lt;/a&gt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ Over the past 24 hours I&#39;ve been reflecting on my life &amp; I&#39;ve realized only one thing. I need a medieval battle axe.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;@allanbranch&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34; title=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34;&gt;twitter.com/allanbranch/status/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;h2 id=&#34;music&#34;&gt;music&lt;/h2&gt;
+
+ &lt;iframe style=&#34;max-width: 100%&#34;
+ class=&#34;music163&#34;
+ frameborder=&#34;no&#34;
+ border=&#34;0&#34;
+ marginwidth=&#34;0&#34;
+ marginheight=&#34;0&#34;
+ width=&#34;330&#34;
+ height=&#34;86&#34;
+ src=&#34;//music.163.com/outchain/player?type=2&amp;id=3950552&amp;auto=0&amp;height=66&#34;&gt;
+ &lt;/iframe&gt;
+
+&lt;h2 id=&#34;gist&#34;&gt;gist&lt;/h2&gt;
+
+&lt;p&gt;We can embed the gist in our content via username and gist ID pulled from the URL:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{&amp;lt; gist spf13 7896402 &amp;gt;}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Display:&lt;/p&gt;
+
+&lt;script src=&#34;//gist.github.com/spf13/7896402.js&#34;&gt;&lt;/script&gt;
+
+&lt;h2 id=&#34;youtube&#34;&gt;youtube&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//www.youtube.com/embed/w7Ft2ymGmfc&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; allowfullscreen frameborder=&#34;0&#34; title=&#34;YouTube Video&#34;&gt;&lt;/iframe&gt;
+ &lt;/div&gt;
+
+
+&lt;h2 id=&#34;vimeo&#34;&gt;vimeo&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//player.vimeo.com/video/146022717&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
+ &lt;/div&gt;</description>
+
</item>
<item>
@@ -51,11 +751,1101 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/english-preview/</guid>
- <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or jane delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;</description>
+
</item>
<item>
@@ -64,12 +1854,84 @@
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/syntax-highlighting/</guid>
- <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+
+ <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
alert(&amp;quot;Hello, World!&amp;quot;)
}
&lt;/code&gt;&lt;/pre&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-kotlin&#34;&gt;package hello
+
+fun main(args: Array&amp;lt;String&amp;gt;) {
+ println(&amp;quot;Hello World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;#include &amp;lt;stdio.h&amp;gt;
+
+/* Hello */
+int main(void){
+ printf(&amp;quot;Hello, World!&amp;quot;);
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cpp&#34;&gt;// &#39;Hello World!&#39; program
+
+#include &amp;lt;iostream&amp;gt;
+
+int main(){
+ std::cout &amp;lt;&amp;lt; &amp;quot;Hello World!&amp;quot; &amp;lt;&amp;lt; std::endl;
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cs&#34;&gt;using System;
+class HelloWorld{
+ public static void Main(){
+ System.Console.WriteLine(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-html&#34;&gt;&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ Hello, World!
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main
+import fmt &amp;quot;fmt&amp;quot;
+
+func main()
+{
+ fmt.Printf(&amp;quot;Hello, World!\n&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-scala&#34;&gt;object HelloWorld with Application {
+ Console.println(&amp;quot;Hello, World!&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-php&#34;&gt;&amp;lt;?php
+ echo &#39;Hello, World!&#39;;
+?&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(&amp;quot;Hello, World!&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;</description>
+
</item>
</channel>
diff --git a/tags/shortcodes/index.html b/tags/shortcodes/index.html
index cefe0bb..8308960 100644
--- a/tags/shortcodes/index.html
+++ b/tags/shortcodes/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Shortcodes" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -178,10 +181,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -239,5 +242,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/shortcodes/index.xml b/tags/shortcodes/index.xml
index 2119794..8009fca 100644
--- a/tags/shortcodes/index.xml
+++ b/tags/shortcodes/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 06 Mar 2018 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/shortcodes/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/shortcodes/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,336 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/jane-theme-preview/</guid>
- <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
+
+ <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
&lt;p&gt;Please note that HTML fragments in markdown source will be recognized but not parsed or rendered. Also, there may be small reformatting on the original markdown source code after saving.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;paragraph-and-line-breaks&#34;&gt;Paragraph and line breaks&lt;/h2&gt;
+
+&lt;p&gt;A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by more than one blank lines. In Typora, you only need to press &lt;code&gt;Return&lt;/code&gt; to create a new paragraph.&lt;/p&gt;
+
+&lt;p&gt;Press &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Return&lt;/code&gt; to create a single line break. However, most markdown parser will ignore single line break, to make other markdown parsers recognize your line break, you can leave two whitespace at the end of the line, or insert &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;headers&#34;&gt;Headers&lt;/h2&gt;
+
+&lt;p&gt;Headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;# This is an H1
+
+## This is an H2
+
+###### This is an H6
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, input ‘#’s followed by title content, and press &lt;code&gt;Return&lt;/code&gt; key will create a header.&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Markdown uses email-style &amp;gt; characters for block quoting. They are presented as:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;This is a blockquote with two paragraphs. This is first paragraph.&lt;/p&gt;
+
+&lt;p&gt;This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.&lt;/p&gt;
+
+&lt;p&gt;This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;In typora, just input ‘&amp;gt;’ followed by quote contents a block quote is generated. Typora will insert proper ‘&amp;gt;’ or line break for you. Block quote inside anther block quote is allowed by adding additional levels of ‘&amp;gt;’.&lt;/p&gt;
+
+&lt;h2 id=&#34;lists&#34;&gt;Lists&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;* list item 1&lt;/code&gt; will create an un-ordered list, the &lt;code&gt;*&lt;/code&gt; symbol can be replace with &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;1. list item 1&lt;/code&gt; will create an ordered list, their markdown source code is like:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;task-list&#34;&gt;Task List&lt;/h2&gt;
+
+&lt;p&gt;Task lists are lists with items marked as either [ ] or &lt;a href=&#34;incomplete or complete&#34;&gt;x&lt;/a&gt;. For example:&lt;/p&gt;
+
+&lt;ul class=&#34;task-list&#34;&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; a task list item&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; list syntax required&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; normal &lt;strong&gt;formatting&lt;/strong&gt;, @mentions, #1234 refs&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; incomplete&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; checked disabled class=&#34;task-list-item&#34;&gt; completed&lt;/label&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;You can change the complete/incomplete state by click the checkbox before the item.&lt;/p&gt;
+
+&lt;h2 id=&#34;syntax-highlighting&#34;&gt;Syntax Highlighting&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+ alert(&amp;quot;Hello, World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;math-blocks&#34;&gt;Math Blocks&lt;/h2&gt;
+
+&lt;p&gt;You can render *LaTeX* mathematical expressions using &lt;strong&gt;MathJax&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;$$&lt;/code&gt;, then press &amp;lsquo;Return&amp;rsquo; key will trigger an input field which accept &lt;em&gt;Tex/LaTex&lt;/em&gt; source. Following is an example:
+$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} &lt;br /&gt;
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 &lt;br /&gt;
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 &lt;br /&gt;
+\end{vmatrix}
+$$&lt;/p&gt;
+
+&lt;p&gt;In markdown source file, math block is &lt;em&gt;LaTeX&lt;/em&gt; expression wrapped by ‘$$’ mark:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} \\
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 \\
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 \\
+\end{vmatrix}
+$$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;tables&#34;&gt;Tables&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;| First Header | Second Header |&lt;/code&gt; and press &lt;code&gt;return&lt;/code&gt; key will create a table with two column.&lt;/p&gt;
+
+&lt;p&gt;After table is created, focus on that table will pop up a toolbar for table, where you can resize, align, or delete table. You can also use context menu to copy and add/delete column/row.&lt;/p&gt;
+
+&lt;p&gt;Following descriptions can be skipped, as markdown source code for tables are generated by typora automatically.&lt;/p&gt;
+
+&lt;p&gt;In markdown source code, they look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;| First Header | Second Header |
+| ------------- | ------------- |
+| Content Cell | Content Cell |
+| Content Cell | Content Cell |
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+&lt;tr&gt;
+&lt;th&gt;First Header&lt;/th&gt;
+&lt;th&gt;Second Header&lt;/th&gt;
+&lt;/tr&gt;
+&lt;/thead&gt;
+
+&lt;tbody&gt;
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h2 id=&#34;footnotes&#34;&gt;Footnotes&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;You can create footnotes like this[^footnote].
+
+[^footnote]: Here is the *text* of the **footnote**.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;You can create footnotes like this&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:footnote&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:footnote&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
+
+&lt;p&gt;Mouse on the ‘footnote’ superscript to see content of the footnote.&lt;/p&gt;
+
+&lt;h2 id=&#34;horizontal-rules&#34;&gt;Horizontal Rules&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;***&lt;/code&gt; or &lt;code&gt;---&lt;/code&gt; on a blank line and press &lt;code&gt;return&lt;/code&gt; will draw a horizontal line.&lt;/p&gt;
+
+&lt;hr /&gt;
+
+&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
+
+&lt;p&gt;Markdown supports two style of links: inline and reference.&lt;/p&gt;
+
+&lt;p&gt;In both styles, the link text is delimited by [square brackets].&lt;/p&gt;
+
+&lt;p&gt;To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example](http://example.com/ &amp;quot;Title&amp;quot;) inline link.
+
+[This link](http://example.net/) has no title attribute.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Title&#34;&gt;an example&lt;/a&gt; inline link. (&lt;code&gt;&amp;lt;p&amp;gt;This is &amp;lt;a href=&amp;quot;http://example.com/&amp;quot; title=&amp;quot;Title&amp;quot;&amp;gt;&lt;/code&gt;)&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://example.net/&#34;&gt;This link&lt;/a&gt; has no title attribute. (&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://example.net/&amp;quot;&amp;gt;This link&amp;lt;/a&amp;gt; has no&lt;/code&gt;)&lt;/p&gt;
+
+&lt;h3 id=&#34;internal-links&#34;&gt;Internal Links&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;You can set the href to headers&lt;/strong&gt;, which will create a bookmark that allow you to jump to that section after clicking. For example:&lt;/p&gt;
+
+&lt;p&gt;Command(on Windows: Ctrl) + Click &lt;a href=&#34;#block-elements&#34;&gt;This link&lt;/a&gt; will jump to header &lt;code&gt;Block Elements&lt;/code&gt;. To see how to write that, please move cursor or click that link with &lt;code&gt;⌘&lt;/code&gt; key pressed to expand the element into markdown source.&lt;/p&gt;
+
+&lt;h3 id=&#34;reference-links&#34;&gt;Reference Links&lt;/h3&gt;
+
+&lt;p&gt;Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example][id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this, on a line by itself:
+
+[id]: http://example.com/ &amp;quot;Optional Title Here&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, they will be rendered like:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Optional Title Here&#34;&gt;an example&lt;/a&gt; reference-style link.&lt;/p&gt;
+
+&lt;p&gt;The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;[Google][]
+And then define the link:
+
+[Google]: http://google.com/
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora click link will expand it for editing, command+click will open the hyperlink in web browser.&lt;/p&gt;
+
+&lt;h2 id=&#34;urls&#34;&gt;URLs&lt;/h2&gt;
+
+&lt;p&gt;Typora allows you to insert urls as links, wrapped by &lt;code&gt;&amp;lt;&lt;/code&gt;brackets&lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;i@typora.io&amp;gt;&lt;/code&gt; becomes &lt;a href=&#34;mailto:i@typora.io&#34;&gt;i@typora.io&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Typora will aslo auto link standard URLs. e.g: www.google.com.&lt;/p&gt;
+
+&lt;h2 id=&#34;images&#34;&gt;Images&lt;/h2&gt;
+
+&lt;p&gt;Image looks similar with links, but it requires an additional &lt;code&gt;!&lt;/code&gt; char before the start of link. Image syntax looks like this:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg &amp;quot;Optional title&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;You are able to use drag &amp;amp; drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag &amp;amp; drop.&lt;/p&gt;
+
+&lt;p&gt;For more tips on images, please read &lt;a href=&#34;http://support.typora.io//Images/&#34;&gt;http://support.typora.io//Images/&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;emphasis&#34;&gt;Emphasis&lt;/h2&gt;
+
+&lt;p&gt;Markdown treats asterisks (&lt;code&gt;*&lt;/code&gt;) and underscores (&lt;code&gt;_&lt;/code&gt;) as indicators of emphasis. Text wrapped with one &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt; will be wrapped with an HTML &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag. E.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;*single asterisks*
+
+_single underscores_
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single asterisks&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single underscores&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;GFM will ignores underscores in words, which is commonly used in code and names, like this:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;wow_great_stuff&lt;/p&gt;
+
+&lt;p&gt;do_this_and_do_that_and_another_thing.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;\*this text is surrounded by literal asterisks\*
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;*&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;strong&#34;&gt;Strong&lt;/h2&gt;
+
+&lt;p&gt;double *’s or _’s will be wrapped with an HTML &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag, e.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;**double asterisks**
+
+__double underscores__
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double asterisks&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double underscores&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;**&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
+
+&lt;p&gt;To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;Use the `printf()` function.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
+
+&lt;h2 id=&#34;strikethrough&#34;&gt;Strikethrough&lt;/h2&gt;
+
+&lt;p&gt;GFM adds syntax to create strikethrough text, which is missing from standard Markdown.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;~~Mistaken text.~~&lt;/code&gt; becomes &lt;del&gt;Mistaken text.&lt;/del&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;underline&#34;&gt;Underline&lt;/h2&gt;
+
+&lt;p&gt;Underline is powered by raw HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;u&amp;gt;Underline&amp;lt;/u&amp;gt;&lt;/code&gt; becomes &lt;u&gt;Underline&lt;/u&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;emoji-happy&#34;&gt;Emoji :happy:&lt;/h2&gt;
+
+&lt;p&gt;Input emoji with syntax &lt;code&gt;😄&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;User can trigger auto-complete suggestions for emoji by pressing &lt;code&gt;ESC&lt;/code&gt; key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from &lt;code&gt;Edit&lt;/code&gt; -&amp;gt; &lt;code&gt;Emoji &amp;amp; Symbols&lt;/code&gt; from menu bar is also supported.&lt;/p&gt;
+
+&lt;h2 id=&#34;inline-math&#34;&gt;Inline Math&lt;/h2&gt;
+
+&lt;p&gt;To use this feature, first, please enable it in &lt;code&gt;Preference&lt;/code&gt; Panel -&amp;gt; &lt;code&gt;Markdown&lt;/code&gt; Tab. Then use &lt;code&gt;$&lt;/code&gt; to wrap TeX command, for example: &lt;code&gt;$\lim_{x \to \infty} \exp(-x) = 0$&lt;/code&gt; will be rendered as LaTeX command.&lt;/p&gt;
+
+&lt;p&gt;To trigger inline preview for inline math: input “$”, then press &lt;code&gt;ESC&lt;/code&gt; key, then input TeX command, a preview tooltip will be visible like below:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;http://typora.io/img/inline-math.gif&#34; style=&#34;zoom:50%;&#34; /&gt;&lt;/p&gt;
+&lt;div class=&#34;footnotes&#34;&gt;
+
+&lt;hr /&gt;
+
+&lt;ol&gt;
+&lt;li id=&#34;fn:footnote&#34;&gt;Here is the &lt;em&gt;text&lt;/em&gt; of the &lt;strong&gt;footnote&lt;/strong&gt;.
+ &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:footnote&#34;&gt;&lt;sup&gt;[return]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
+&lt;/ol&gt;
+&lt;/div&gt;</description>
+
</item>
<item>
@@ -30,7 +355,8 @@
<pubDate>Sun, 04 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/shortcodes-preview/</guid>
- <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
&lt;p&gt;Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video &lt;code&gt;&amp;lt;iframes&amp;gt;&lt;/code&gt;) to Markdown content. We think this contradicts the beautiful simplicity of Markdown&amp;rsquo;s syntax.&lt;/p&gt;
@@ -42,7 +368,381 @@
&lt;p&gt;More details: &lt;a href=&#34;https://gohugo.io/content-management/shortcodes/&#34;&gt;https://gohugo.io/content-management/shortcodes/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Normal quote:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a simple quote.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote with only an Author named Author2.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author2&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author3 and source &#34;source.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author3&lt;/strong&gt;
+
+ &lt;cite&gt;Source&lt;/cite&gt;
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and link:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author4 and links to https://www.google.com.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author4&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;google.com&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author, link and title:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://www.google.com with title &#34;Google.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author5&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;Google&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and a link longer than 32 characters, string is first cut at 32 characters then everything after the last forward slash is removed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://twitter.com/CryptoGangsta/status/716427930126196737 which is longer than 32 characters.
+ &lt;br&gt;And this is a new line in the quote with the HTML br tag.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author6&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34; title=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34;&gt;twitter.com/CryptoGangsta/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Test from the Octopress blockquote page at: &lt;a href=&#34;http://octopress.org/docs/plugins/blockquote/&#34;&gt;http://octopress.org/docs/plugins/blockquote/&lt;/a&gt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ Over the past 24 hours I&#39;ve been reflecting on my life &amp; I&#39;ve realized only one thing. I need a medieval battle axe.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;@allanbranch&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34; title=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34;&gt;twitter.com/allanbranch/status/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;h2 id=&#34;music&#34;&gt;music&lt;/h2&gt;
+
+ &lt;iframe style=&#34;max-width: 100%&#34;
+ class=&#34;music163&#34;
+ frameborder=&#34;no&#34;
+ border=&#34;0&#34;
+ marginwidth=&#34;0&#34;
+ marginheight=&#34;0&#34;
+ width=&#34;330&#34;
+ height=&#34;86&#34;
+ src=&#34;//music.163.com/outchain/player?type=2&amp;id=3950552&amp;auto=0&amp;height=66&#34;&gt;
+ &lt;/iframe&gt;
+
+&lt;h2 id=&#34;gist&#34;&gt;gist&lt;/h2&gt;
+
+&lt;p&gt;We can embed the gist in our content via username and gist ID pulled from the URL:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{&amp;lt; gist spf13 7896402 &amp;gt;}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Display:&lt;/p&gt;
+
+&lt;script src=&#34;//gist.github.com/spf13/7896402.js&#34;&gt;&lt;/script&gt;
+
+&lt;h2 id=&#34;youtube&#34;&gt;youtube&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//www.youtube.com/embed/w7Ft2ymGmfc&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; allowfullscreen frameborder=&#34;0&#34; title=&#34;YouTube Video&#34;&gt;&lt;/iframe&gt;
+ &lt;/div&gt;
+
+
+&lt;h2 id=&#34;vimeo&#34;&gt;vimeo&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//player.vimeo.com/video/146022717&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
+ &lt;/div&gt;</description>
+
</item>
</channel>
diff --git a/tags/syntax-highlighting/index.html b/tags/syntax-highlighting/index.html
index d4ed997..64b2f91 100644
--- a/tags/syntax-highlighting/index.html
+++ b/tags/syntax-highlighting/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Syntax Highlighting" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -167,10 +170,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -228,5 +231,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/syntax-highlighting/index.xml b/tags/syntax-highlighting/index.xml
index 54de7e8..68191ff 100644
--- a/tags/syntax-highlighting/index.xml
+++ b/tags/syntax-highlighting/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 30 Aug 2011 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/syntax-highlighting/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/syntax-highlighting/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,12 +17,84 @@
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/syntax-highlighting/</guid>
- <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+
+ <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
alert(&amp;quot;Hello, World!&amp;quot;)
}
&lt;/code&gt;&lt;/pre&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-kotlin&#34;&gt;package hello
+
+fun main(args: Array&amp;lt;String&amp;gt;) {
+ println(&amp;quot;Hello World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;#include &amp;lt;stdio.h&amp;gt;
+
+/* Hello */
+int main(void){
+ printf(&amp;quot;Hello, World!&amp;quot;);
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cpp&#34;&gt;// &#39;Hello World!&#39; program
+
+#include &amp;lt;iostream&amp;gt;
+
+int main(){
+ std::cout &amp;lt;&amp;lt; &amp;quot;Hello World!&amp;quot; &amp;lt;&amp;lt; std::endl;
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cs&#34;&gt;using System;
+class HelloWorld{
+ public static void Main(){
+ System.Console.WriteLine(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-html&#34;&gt;&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ Hello, World!
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main
+import fmt &amp;quot;fmt&amp;quot;
+
+func main()
+{
+ fmt.Printf(&amp;quot;Hello, World!\n&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-scala&#34;&gt;object HelloWorld with Application {
+ Console.println(&amp;quot;Hello, World!&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-php&#34;&gt;&amp;lt;?php
+ echo &#39;Hello, World!&#39;;
+?&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(&amp;quot;Hello, World!&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;</description>
+
</item>
</channel>
diff --git a/tags/tag-2/index.html b/tags/tag-2/index.html
index 657c935..deeb193 100644
--- a/tags/tag-2/index.html
+++ b/tags/tag-2/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Tag 2" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -167,10 +170,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -228,5 +231,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/tag-2/index.xml b/tags/tag-2/index.xml
index 1a4d4dd..a0677d0 100644
--- a/tags/tag-2/index.xml
+++ b/tags/tag-2/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Thu, 31 Aug 2017 15:43:48 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/tag-2/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/tag-2/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,1101 @@
<pubDate>Thu, 31 Aug 2017 15:43:48 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/english-preview/</guid>
- <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or jane delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;</description>
+
</item>
</channel>
diff --git a/tags/tag-5/index.html b/tags/tag-5/index.html
index fbaf290..50b9f36 100644
--- a/tags/tag-5/index.html
+++ b/tags/tag-5/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Tag 5" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -167,10 +170,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -228,5 +231,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/tag-5/index.xml b/tags/tag-5/index.xml
index cf180ac..5b0986a 100644
--- a/tags/tag-5/index.xml
+++ b/tags/tag-5/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 30 Aug 2011 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/tag-5/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/tag-5/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,12 +17,84 @@
<pubDate>Tue, 30 Aug 2011 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/syntax-highlighting/</guid>
- <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+
+ <description>&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
alert(&amp;quot;Hello, World!&amp;quot;)
}
&lt;/code&gt;&lt;/pre&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-kotlin&#34;&gt;package hello
+
+fun main(args: Array&amp;lt;String&amp;gt;) {
+ println(&amp;quot;Hello World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-c&#34;&gt;#include &amp;lt;stdio.h&amp;gt;
+
+/* Hello */
+int main(void){
+ printf(&amp;quot;Hello, World!&amp;quot;);
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cpp&#34;&gt;// &#39;Hello World!&#39; program
+
+#include &amp;lt;iostream&amp;gt;
+
+int main(){
+ std::cout &amp;lt;&amp;lt; &amp;quot;Hello World!&amp;quot; &amp;lt;&amp;lt; std::endl;
+ return 0;
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-cs&#34;&gt;using System;
+class HelloWorld{
+ public static void Main(){
+ System.Console.WriteLine(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-html&#34;&gt;&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ Hello, World!
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-go&#34;&gt;package main
+import fmt &amp;quot;fmt&amp;quot;
+
+func main()
+{
+ fmt.Printf(&amp;quot;Hello, World!\n&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-scala&#34;&gt;object HelloWorld with Application {
+ Console.println(&amp;quot;Hello, World!&amp;quot;);
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-php&#34;&gt;&amp;lt;?php
+ echo &#39;Hello, World!&#39;;
+?&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(&amp;quot;Hello, World!&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;</description>
+
</item>
</channel>
diff --git a/tags/tag-6/index.html b/tags/tag-6/index.html
index 92f6eb3..4bef777 100644
--- a/tags/tag-6/index.html
+++ b/tags/tag-6/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Tag 6" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -178,10 +181,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -239,5 +242,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/tag-6/index.xml b/tags/tag-6/index.xml
index df690b6..b2b5c02 100644
--- a/tags/tag-6/index.xml
+++ b/tags/tag-6/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Tue, 06 Mar 2018 16:01:23 +0800</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/tag-6/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/tag-6/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,11 +17,336 @@
<pubDate>Tue, 06 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/jane-theme-preview/</guid>
- <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
+
+ <description>&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is created by &lt;a href=&#34;http://daringfireball.net/&#34;&gt;Daring Fireball&lt;/a&gt;, the original guideline is &lt;a href=&#34;http://daringfireball.net/projects/markdown/syntax&#34;&gt;here&lt;/a&gt;. Its syntax, however, varies between different parsers or editors.&lt;/p&gt;
&lt;p&gt;Please note that HTML fragments in markdown source will be recognized but not parsed or rendered. Also, there may be small reformatting on the original markdown source code after saving.&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;paragraph-and-line-breaks&#34;&gt;Paragraph and line breaks&lt;/h2&gt;
+
+&lt;p&gt;A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by more than one blank lines. In Typora, you only need to press &lt;code&gt;Return&lt;/code&gt; to create a new paragraph.&lt;/p&gt;
+
+&lt;p&gt;Press &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Return&lt;/code&gt; to create a single line break. However, most markdown parser will ignore single line break, to make other markdown parsers recognize your line break, you can leave two whitespace at the end of the line, or insert &lt;code&gt;&amp;lt;br/&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;headers&#34;&gt;Headers&lt;/h2&gt;
+
+&lt;p&gt;Headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;# This is an H1
+
+## This is an H2
+
+###### This is an H6
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, input ‘#’s followed by title content, and press &lt;code&gt;Return&lt;/code&gt; key will create a header.&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Markdown uses email-style &amp;gt; characters for block quoting. They are presented as:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;This is a blockquote with two paragraphs. This is first paragraph.&lt;/p&gt;
+
+&lt;p&gt;This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.&lt;/p&gt;
+
+&lt;p&gt;This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;In typora, just input ‘&amp;gt;’ followed by quote contents a block quote is generated. Typora will insert proper ‘&amp;gt;’ or line break for you. Block quote inside anther block quote is allowed by adding additional levels of ‘&amp;gt;’.&lt;/p&gt;
+
+&lt;h2 id=&#34;lists&#34;&gt;Lists&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;* list item 1&lt;/code&gt; will create an un-ordered list, the &lt;code&gt;*&lt;/code&gt; symbol can be replace with &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;1. list item 1&lt;/code&gt; will create an ordered list, their markdown source code is like:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;task-list&#34;&gt;Task List&lt;/h2&gt;
+
+&lt;p&gt;Task lists are lists with items marked as either [ ] or &lt;a href=&#34;incomplete or complete&#34;&gt;x&lt;/a&gt;. For example:&lt;/p&gt;
+
+&lt;ul class=&#34;task-list&#34;&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; a task list item&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; list syntax required&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; normal &lt;strong&gt;formatting&lt;/strong&gt;, @mentions, #1234 refs&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; disabled class=&#34;task-list-item&#34;&gt; incomplete&lt;/label&gt;&lt;/li&gt;
+&lt;li&gt;&lt;label&gt;&lt;input type=&#34;checkbox&#34; checked disabled class=&#34;task-list-item&#34;&gt; completed&lt;/label&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;You can change the complete/incomplete state by click the checkbox before the item.&lt;/p&gt;
+
+&lt;h2 id=&#34;syntax-highlighting&#34;&gt;Syntax Highlighting&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-js&#34;&gt;function helloWorld () {
+ alert(&amp;quot;Hello, World!&amp;quot;)
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-java&#34;&gt;public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println(&amp;quot;Hello, World!&amp;quot;);
+ }
+}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;math-blocks&#34;&gt;Math Blocks&lt;/h2&gt;
+
+&lt;p&gt;You can render *LaTeX* mathematical expressions using &lt;strong&gt;MathJax&lt;/strong&gt;.&lt;/p&gt;
+
+&lt;p&gt;Input &lt;code&gt;$$&lt;/code&gt;, then press &amp;lsquo;Return&amp;rsquo; key will trigger an input field which accept &lt;em&gt;Tex/LaTex&lt;/em&gt; source. Following is an example:
+$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} &lt;br /&gt;
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 &lt;br /&gt;
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 &lt;br /&gt;
+\end{vmatrix}
+$$&lt;/p&gt;
+
+&lt;p&gt;In markdown source file, math block is &lt;em&gt;LaTeX&lt;/em&gt; expression wrapped by ‘$$’ mark:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;$$
+\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
+\mathbf{i} &amp;amp; \mathbf{j} &amp;amp; \mathbf{k} \\
+\frac{\partial X}{\partial u} &amp;amp; \frac{\partial Y}{\partial u} &amp;amp; 0 \\
+\frac{\partial X}{\partial v} &amp;amp; \frac{\partial Y}{\partial v} &amp;amp; 0 \\
+\end{vmatrix}
+$$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;tables&#34;&gt;Tables&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;| First Header | Second Header |&lt;/code&gt; and press &lt;code&gt;return&lt;/code&gt; key will create a table with two column.&lt;/p&gt;
+
+&lt;p&gt;After table is created, focus on that table will pop up a toolbar for table, where you can resize, align, or delete table. You can also use context menu to copy and add/delete column/row.&lt;/p&gt;
+
+&lt;p&gt;Following descriptions can be skipped, as markdown source code for tables are generated by typora automatically.&lt;/p&gt;
+
+&lt;p&gt;In markdown source code, they look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;| First Header | Second Header |
+| ------------- | ------------- |
+| Content Cell | Content Cell |
+| Content Cell | Content Cell |
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+&lt;tr&gt;
+&lt;th&gt;First Header&lt;/th&gt;
+&lt;th&gt;Second Header&lt;/th&gt;
+&lt;/tr&gt;
+&lt;/thead&gt;
+
+&lt;tbody&gt;
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+
+&lt;tr&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;td&gt;Content Cell&lt;/td&gt;
+&lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;h2 id=&#34;footnotes&#34;&gt;Footnotes&lt;/h2&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;You can create footnotes like this[^footnote].
+
+[^footnote]: Here is the *text* of the **footnote**.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;You can create footnotes like this&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:footnote&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:footnote&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
+
+&lt;p&gt;Mouse on the ‘footnote’ superscript to see content of the footnote.&lt;/p&gt;
+
+&lt;h2 id=&#34;horizontal-rules&#34;&gt;Horizontal Rules&lt;/h2&gt;
+
+&lt;p&gt;Input &lt;code&gt;***&lt;/code&gt; or &lt;code&gt;---&lt;/code&gt; on a blank line and press &lt;code&gt;return&lt;/code&gt; will draw a horizontal line.&lt;/p&gt;
+
+&lt;hr /&gt;
+
+&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
+
+&lt;p&gt;Markdown supports two style of links: inline and reference.&lt;/p&gt;
+
+&lt;p&gt;In both styles, the link text is delimited by [square brackets].&lt;/p&gt;
+
+&lt;p&gt;To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example](http://example.com/ &amp;quot;Title&amp;quot;) inline link.
+
+[This link](http://example.net/) has no title attribute.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Title&#34;&gt;an example&lt;/a&gt; inline link. (&lt;code&gt;&amp;lt;p&amp;gt;This is &amp;lt;a href=&amp;quot;http://example.com/&amp;quot; title=&amp;quot;Title&amp;quot;&amp;gt;&lt;/code&gt;)&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://example.net/&#34;&gt;This link&lt;/a&gt; has no title attribute. (&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://example.net/&amp;quot;&amp;gt;This link&amp;lt;/a&amp;gt; has no&lt;/code&gt;)&lt;/p&gt;
+
+&lt;h3 id=&#34;internal-links&#34;&gt;Internal Links&lt;/h3&gt;
+
+&lt;p&gt;&lt;strong&gt;You can set the href to headers&lt;/strong&gt;, which will create a bookmark that allow you to jump to that section after clicking. For example:&lt;/p&gt;
+
+&lt;p&gt;Command(on Windows: Ctrl) + Click &lt;a href=&#34;#block-elements&#34;&gt;This link&lt;/a&gt; will jump to header &lt;code&gt;Block Elements&lt;/code&gt;. To see how to write that, please move cursor or click that link with &lt;code&gt;⌘&lt;/code&gt; key pressed to expand the element into markdown source.&lt;/p&gt;
+
+&lt;h3 id=&#34;reference-links&#34;&gt;Reference Links&lt;/h3&gt;
+
+&lt;p&gt;Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;This is [an example][id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this, on a line by itself:
+
+[id]: http://example.com/ &amp;quot;Optional Title Here&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora, they will be rendered like:&lt;/p&gt;
+
+&lt;p&gt;This is &lt;a href=&#34;http://example.com/&#34; title=&#34;Optional Title Here&#34;&gt;an example&lt;/a&gt; reference-style link.&lt;/p&gt;
+
+&lt;p&gt;The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;[Google][]
+And then define the link:
+
+[Google]: http://google.com/
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;In typora click link will expand it for editing, command+click will open the hyperlink in web browser.&lt;/p&gt;
+
+&lt;h2 id=&#34;urls&#34;&gt;URLs&lt;/h2&gt;
+
+&lt;p&gt;Typora allows you to insert urls as links, wrapped by &lt;code&gt;&amp;lt;&lt;/code&gt;brackets&lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;i@typora.io&amp;gt;&lt;/code&gt; becomes &lt;a href=&#34;mailto:i@typora.io&#34;&gt;i@typora.io&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Typora will aslo auto link standard URLs. e.g: www.google.com.&lt;/p&gt;
+
+&lt;h2 id=&#34;images&#34;&gt;Images&lt;/h2&gt;
+
+&lt;p&gt;Image looks similar with links, but it requires an additional &lt;code&gt;!&lt;/code&gt; char before the start of link. Image syntax looks like this:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg &amp;quot;Optional title&amp;quot;)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;You are able to use drag &amp;amp; drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag &amp;amp; drop.&lt;/p&gt;
+
+&lt;p&gt;For more tips on images, please read &lt;a href=&#34;http://support.typora.io//Images/&#34;&gt;http://support.typora.io//Images/&lt;/a&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;emphasis&#34;&gt;Emphasis&lt;/h2&gt;
+
+&lt;p&gt;Markdown treats asterisks (&lt;code&gt;*&lt;/code&gt;) and underscores (&lt;code&gt;_&lt;/code&gt;) as indicators of emphasis. Text wrapped with one &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt; will be wrapped with an HTML &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag. E.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;*single asterisks*
+
+_single underscores_
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single asterisks&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;em&gt;single underscores&lt;/em&gt;&lt;/p&gt;
+
+&lt;p&gt;GFM will ignores underscores in words, which is commonly used in code and names, like this:&lt;/p&gt;
+
+&lt;blockquote&gt;
+&lt;p&gt;wow_great_stuff&lt;/p&gt;
+
+&lt;p&gt;do_this_and_do_that_and_another_thing.&lt;/p&gt;
+&lt;/blockquote&gt;
+
+&lt;p&gt;To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;\*this text is surrounded by literal asterisks\*
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;*&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;strong&#34;&gt;Strong&lt;/h2&gt;
+
+&lt;p&gt;double *’s or _’s will be wrapped with an HTML &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag, e.g:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;**double asterisks**
+
+__double underscores__
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;output:&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double asterisks&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;double underscores&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Typora recommends to use &lt;code&gt;**&lt;/code&gt; symbol.&lt;/p&gt;
+
+&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
+
+&lt;p&gt;To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-markdown&#34;&gt;Use the `printf()` function.
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;will produce:&lt;/p&gt;
+
+&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
+
+&lt;h2 id=&#34;strikethrough&#34;&gt;Strikethrough&lt;/h2&gt;
+
+&lt;p&gt;GFM adds syntax to create strikethrough text, which is missing from standard Markdown.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;~~Mistaken text.~~&lt;/code&gt; becomes &lt;del&gt;Mistaken text.&lt;/del&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;underline&#34;&gt;Underline&lt;/h2&gt;
+
+&lt;p&gt;Underline is powered by raw HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;code&gt;&amp;lt;u&amp;gt;Underline&amp;lt;/u&amp;gt;&lt;/code&gt; becomes &lt;u&gt;Underline&lt;/u&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;emoji-happy&#34;&gt;Emoji :happy:&lt;/h2&gt;
+
+&lt;p&gt;Input emoji with syntax &lt;code&gt;😄&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;User can trigger auto-complete suggestions for emoji by pressing &lt;code&gt;ESC&lt;/code&gt; key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from &lt;code&gt;Edit&lt;/code&gt; -&amp;gt; &lt;code&gt;Emoji &amp;amp; Symbols&lt;/code&gt; from menu bar is also supported.&lt;/p&gt;
+
+&lt;h2 id=&#34;inline-math&#34;&gt;Inline Math&lt;/h2&gt;
+
+&lt;p&gt;To use this feature, first, please enable it in &lt;code&gt;Preference&lt;/code&gt; Panel -&amp;gt; &lt;code&gt;Markdown&lt;/code&gt; Tab. Then use &lt;code&gt;$&lt;/code&gt; to wrap TeX command, for example: &lt;code&gt;$\lim_{x \to \infty} \exp(-x) = 0$&lt;/code&gt; will be rendered as LaTeX command.&lt;/p&gt;
+
+&lt;p&gt;To trigger inline preview for inline math: input “$”, then press &lt;code&gt;ESC&lt;/code&gt; key, then input TeX command, a preview tooltip will be visible like below:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;http://typora.io/img/inline-math.gif&#34; style=&#34;zoom:50%;&#34; /&gt;&lt;/p&gt;
+&lt;div class=&#34;footnotes&#34;&gt;
+
+&lt;hr /&gt;
+
+&lt;ol&gt;
+&lt;li id=&#34;fn:footnote&#34;&gt;Here is the &lt;em&gt;text&lt;/em&gt; of the &lt;strong&gt;footnote&lt;/strong&gt;.
+ &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:footnote&#34;&gt;&lt;sup&gt;[return]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
+&lt;/ol&gt;
+&lt;/div&gt;</description>
+
</item>
<item>
@@ -30,7 +355,8 @@
<pubDate>Sun, 04 Mar 2018 16:01:23 +0800</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/shortcodes-preview/</guid>
- <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
+
+ <description>&lt;h2 id=&#34;what-a-shortcode-is&#34;&gt;What a Shortcode is&lt;/h2&gt;
&lt;p&gt;Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video &lt;code&gt;&amp;lt;iframes&amp;gt;&lt;/code&gt;) to Markdown content. We think this contradicts the beautiful simplicity of Markdown&amp;rsquo;s syntax.&lt;/p&gt;
@@ -42,7 +368,381 @@
&lt;p&gt;More details: &lt;a href=&#34;https://gohugo.io/content-management/shortcodes/&#34;&gt;https://gohugo.io/content-management/shortcodes/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;/p&gt;</description>
+&lt;p&gt;&lt;/p&gt;
+
+&lt;h2 id=&#34;blockquotes&#34;&gt;blockquotes&lt;/h2&gt;
+
+&lt;p&gt;Normal quote:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a simple quote.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote with only an Author named Author2.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author2&lt;/strong&gt;
+
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author3 and source &#34;source.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author3&lt;/strong&gt;
+
+ &lt;cite&gt;Source&lt;/cite&gt;
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and link:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author4 and links to https://www.google.com.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author4&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;google.com&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author, link and title:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://www.google.com with title &#34;Google.&#34;
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author5&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://www.google.com&#34; title=&#34;https://www.google.com&#34;&gt;Google&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Quote with author and a link longer than 32 characters, string is first cut at 32 characters then everything after the last forward slash is removed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ This is a quote from Author5 and links to https://twitter.com/CryptoGangsta/status/716427930126196737 which is longer than 32 characters.
+ &lt;br&gt;And this is a new line in the quote with the HTML br tag.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;Author6&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34; title=&#34;https://twitter.com/CryptoGangsta/status/716427930126196737&#34;&gt;twitter.com/CryptoGangsta/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;p&gt;Test from the Octopress blockquote page at: &lt;a href=&#34;http://octopress.org/docs/plugins/blockquote/&#34;&gt;http://octopress.org/docs/plugins/blockquote/&lt;/a&gt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+&lt;blockquote&gt;
+ &lt;p&gt;
+ Over the past 24 hours I&#39;ve been reflecting on my life &amp; I&#39;ve realized only one thing. I need a medieval battle axe.
+&lt;/p&gt;
+ &lt;footer&gt;
+ &lt;strong&gt;@allanbranch&lt;/strong&gt;
+
+
+ &lt;cite&gt;
+ &lt;a href=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34; title=&#34;https://twitter.com/allanbranch/status/90766146063712256&#34;&gt;twitter.com/allanbranch/status/...&lt;/a&gt;
+ &lt;/cite&gt;
+
+
+ &lt;/footer&gt;
+&lt;/blockquote&gt;
+&lt;/p&gt;
+
+&lt;h2 id=&#34;music&#34;&gt;music&lt;/h2&gt;
+
+ &lt;iframe style=&#34;max-width: 100%&#34;
+ class=&#34;music163&#34;
+ frameborder=&#34;no&#34;
+ border=&#34;0&#34;
+ marginwidth=&#34;0&#34;
+ marginheight=&#34;0&#34;
+ width=&#34;330&#34;
+ height=&#34;86&#34;
+ src=&#34;//music.163.com/outchain/player?type=2&amp;id=3950552&amp;auto=0&amp;height=66&#34;&gt;
+ &lt;/iframe&gt;
+
+&lt;h2 id=&#34;gist&#34;&gt;gist&lt;/h2&gt;
+
+&lt;p&gt;We can embed the gist in our content via username and gist ID pulled from the URL:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{&amp;lt; gist spf13 7896402 &amp;gt;}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Display:&lt;/p&gt;
+
+&lt;script src=&#34;//gist.github.com/spf13/7896402.js&#34;&gt;&lt;/script&gt;
+
+&lt;h2 id=&#34;youtube&#34;&gt;youtube&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//www.youtube.com/embed/w7Ft2ymGmfc&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; allowfullscreen frameborder=&#34;0&#34; title=&#34;YouTube Video&#34;&gt;&lt;/iframe&gt;
+ &lt;/div&gt;
+
+
+&lt;h2 id=&#34;vimeo&#34;&gt;vimeo&lt;/h2&gt;
+
+
+&lt;div style=&#34;position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;&#34;&gt;
+ &lt;iframe src=&#34;//player.vimeo.com/video/146022717&#34; style=&#34;position: absolute; top: 0; left: 0; width: 100%; height: 100%;&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
+ &lt;/div&gt;</description>
+
</item>
</channel>
diff --git a/tags/templates/index.html b/tags/templates/index.html
index a5765d6..2cb25d4 100644
--- a/tags/templates/index.html
+++ b/tags/templates/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Templates" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -189,10 +192,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -250,5 +253,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/templates/index.xml b/tags/templates/index.xml
index af837bc..177e58c 100644
--- a/tags/templates/index.xml
+++ b/tags/templates/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/templates/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/templates/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,8 +17,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -27,8 +1121,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -37,9 +1469,177 @@ This document is a brief primer on using go templates.</description>
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
</channel>
diff --git a/tags/themes/index.html b/tags/themes/index.html
index 7a24de6..6b54a60 100644
--- a/tags/themes/index.html
+++ b/tags/themes/index.html
@@ -47,6 +47,9 @@
<link href="/hugo-theme-jane/dist/jane.min.css?v=2.7.0" rel="stylesheet">
<link href="/hugo-theme-jane/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">
+
+
+
<meta property="og:title" content="Themes" />
<meta property="og:description" content="Hugo theme jane example site." />
<meta property="og:type" content="website" />
@@ -189,10 +192,10 @@ ga('send', 'pageview');
</section>
-<nav class="pagination">
-
-
-</nav>
+
+
+
+
</div>
</div>
@@ -250,5 +253,8 @@ ga('send', 'pageview');
<script type="text/javascript" src="/hugo-theme-jane/dist/jane.min.js?v=2.7.0"></script>
+
+
+
</body>
</html>
diff --git a/tags/themes/index.xml b/tags/themes/index.xml
index 0441a98..3fe40f7 100644
--- a/tags/themes/index.xml
+++ b/tags/themes/index.xml
@@ -8,7 +8,7 @@
<language>en</language>
<lastBuildDate>Sun, 28 Sep 2014 00:00:00 +0000</lastBuildDate>
- <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/themes/index.xml" rel="self" type="application/rss+xml" />
+ <atom:link href="http://en.xianmin.org/hugo-theme-jane/tags/themes/index.xml" rel="self" type="application/rss+xml" />
<item>
@@ -17,8 +17,1102 @@
<pubDate>Sun, 28 Sep 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/creating-a-new-theme/</guid>
- <description>Introduction This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.
-We&amp;rsquo;ll start with creating a new site with a very basic template.</description>
+
+ <description>
+
+&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
+
+&lt;p&gt;This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&amp;rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&amp;rsquo;t cover using CSS to style your theme.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start with creating a new site with a very basic template. Then we&amp;rsquo;ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.&lt;/p&gt;
+
+&lt;p&gt;In this tutorial, commands that you enter will start with the &amp;ldquo;$&amp;rdquo; prompt. The output will follow. Lines that start with &amp;ldquo;#&amp;rdquo; are comments that I&amp;rsquo;ve added to explain a point. When I show updates to a file, the &amp;ldquo;:wq&amp;rdquo; on the last line means to save the file.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s an example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## this is a comment
+$ echo this is a command
+this is a command
+
+## edit the file
+$vi foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+:wq
+
+## show it
+$ cat foo.md
++++
+date = &amp;quot;2014-09-28&amp;quot;
+title = &amp;quot;creating a new theme&amp;quot;
++++
+
+bah and humbug
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;some-definitions&#34;&gt;Some Definitions&lt;/h2&gt;
+
+&lt;p&gt;There are a few concepts that you need to understand before creating a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;skins&#34;&gt;Skins&lt;/h3&gt;
+
+&lt;p&gt;Skins are the files responsible for the look and feel of your site. It’s the CSS that controls colors and fonts, it’s the Javascript that determines actions and reactions. It’s also the rules that Hugo uses to transform your content into the HTML that the site will serve to visitors.&lt;/p&gt;
+
+&lt;p&gt;You have two ways to create a skin. The simplest way is to create it in the &lt;code&gt;layouts/&lt;/code&gt; directory. If you do, then you don’t have to worry about configuring Hugo to recognize it. The first place that Hugo will look for rules and files is in the &lt;code&gt;layouts/&lt;/code&gt; directory so it will always find the skin.&lt;/p&gt;
+
+&lt;p&gt;Your second choice is to create it in a sub-directory of the &lt;code&gt;themes/&lt;/code&gt; directory. If you do, then you must always tell Hugo where to search for the skin. It’s extra work, though, so why bother with it?&lt;/p&gt;
+
+&lt;p&gt;The difference between creating a skin in &lt;code&gt;layouts/&lt;/code&gt; and creating it in &lt;code&gt;themes/&lt;/code&gt; is very subtle. A skin in &lt;code&gt;layouts/&lt;/code&gt; can’t be customized without updating the templates and static files that it is built from. A skin created in &lt;code&gt;themes/&lt;/code&gt;, on the other hand, can be and that makes it easier for other people to use it.&lt;/p&gt;
+
+&lt;p&gt;The rest of this tutorial will call a skin created in the &lt;code&gt;themes/&lt;/code&gt; directory a theme.&lt;/p&gt;
+
+&lt;p&gt;Note that you can use this tutorial to create a skin in the &lt;code&gt;layouts/&lt;/code&gt; directory if you wish to. The main difference will be that you won’t need to update the site’s configuration file to use a theme.&lt;/p&gt;
+
+&lt;h3 id=&#34;the-home-page&#34;&gt;The Home Page&lt;/h3&gt;
+
+&lt;p&gt;The home page, or landing page, is the first page that many visitors to a site see. It is the index.html file in the root directory of the web site. Since Hugo writes files to the public/ directory, our home page is public/index.html.&lt;/p&gt;
+
+&lt;h3 id=&#34;site-configuration-file&#34;&gt;Site Configuration File&lt;/h3&gt;
+
+&lt;p&gt;When Hugo runs, it looks for a configuration file that contains settings that override default values for the entire site. The file can use TOML, YAML, or JSON. I prefer to use TOML for my configuration files. If you prefer to use JSON or YAML, you’ll need to translate my examples. You’ll also need to change the name of the file since Hugo uses the extension to determine how to process it.&lt;/p&gt;
+
+&lt;p&gt;Hugo translates Markdown files into HTML. By default, Hugo expects to find Markdown files in your &lt;code&gt;content/&lt;/code&gt; directory and template files in your &lt;code&gt;themes/&lt;/code&gt; directory. It will create HTML files in your &lt;code&gt;public/&lt;/code&gt; directory. You can change this by specifying alternate locations in the configuration file.&lt;/p&gt;
+
+&lt;h3 id=&#34;content&#34;&gt;Content&lt;/h3&gt;
+
+&lt;p&gt;Content is stored in text files that contain two sections. The first section is the “front matter,” which is the meta-information on the content. The second section contains Markdown that will be converted to HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;front-matter&#34;&gt;Front Matter&lt;/h4&gt;
+
+&lt;p&gt;The front matter is information about the content. Like the configuration file, it can be written in TOML, YAML, or JSON. Unlike the configuration file, Hugo doesn’t use the file’s extension to know the format. It looks for markers to signal the type. TOML is surrounded by “&lt;code&gt;+++&lt;/code&gt;”, YAML by “&lt;code&gt;---&lt;/code&gt;”, and JSON is enclosed in curly braces. I prefer to use TOML, so you’ll need to translate my examples if you prefer YAML or JSON.&lt;/p&gt;
+
+&lt;p&gt;The information in the front matter is passed into the template before the content is rendered into HTML.&lt;/p&gt;
+
+&lt;h4 id=&#34;markdown&#34;&gt;Markdown&lt;/h4&gt;
+
+&lt;p&gt;Content is written in Markdown which makes it easier to create the content. Hugo runs the content through a Markdown engine to create the HTML which will be written to the output file.&lt;/p&gt;
+
+&lt;h3 id=&#34;template-files&#34;&gt;Template Files&lt;/h3&gt;
+
+&lt;p&gt;Hugo uses template files to render content into HTML. Template files are a bridge between the content and presentation. Rules in the template define what content is published, where it&amp;rsquo;s published to, and how it will rendered to the HTML file. The template guides the presentation by specifying the style to use.&lt;/p&gt;
+
+&lt;p&gt;There are three types of templates: single, list, and partial. Each type takes a bit of content as input and transforms it based on the commands in the template.&lt;/p&gt;
+
+&lt;p&gt;Hugo uses its knowledge of the content to find the template file used to render the content. If it can’t find a template that is an exact match for the content, it will shift up a level and search from there. It will continue to do so until it finds a matching template or runs out of templates to try. If it can’t find a template, it will use the default template for the site.&lt;/p&gt;
+
+&lt;p&gt;Please note that you can use the front matter to influence Hugo’s choice of templates.&lt;/p&gt;
+
+&lt;h4 id=&#34;single-template&#34;&gt;Single Template&lt;/h4&gt;
+
+&lt;p&gt;A single template is used to render a single piece of content. For example, an article or post would be a single piece of content and use a single template.&lt;/p&gt;
+
+&lt;h4 id=&#34;list-template&#34;&gt;List Template&lt;/h4&gt;
+
+&lt;p&gt;A list template renders a group of related content. That could be a summary of recent postings or all articles in a category. List templates can contain multiple groups.&lt;/p&gt;
+
+&lt;p&gt;The homepage template is a special type of list template. Hugo assumes that the home page of your site will act as the portal for the rest of the content in the site.&lt;/p&gt;
+
+&lt;h4 id=&#34;partial-template&#34;&gt;Partial Template&lt;/h4&gt;
+
+&lt;p&gt;A partial template is a template that can be included in other templates. Partial templates must be called using the “partial” template command. They are very handy for rolling up common behavior. For example, your site may have a banner that all pages use. Instead of copying the text of the banner into every single and list template, you could create a partial with the banner in it. That way if you decide to change the banner, you only have to change the partial template.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-site&#34;&gt;Create a New Site&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s use Hugo to create a new web site. I&amp;rsquo;m a Mac user, so I&amp;rsquo;ll create mine in my home directory, in the Sites folder. If you&amp;rsquo;re using Linux, you might have to create the folder first.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new site&amp;rdquo; command will create a skeleton of a site. It will give you the basic directory structure and a useable configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new site ~/Sites/zafta
+$ cd ~/Sites/zafta
+$ ls -l
+total 8
+drwxr-xr-x 7 quoha staff 238 Sep 29 16:49 .
+drwxr-xr-x 3 quoha staff 102 Sep 29 16:49 ..
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Take a look in the content/ directory to confirm that it is empty.&lt;/p&gt;
+
+&lt;p&gt;The other directories (archetypes/, layouts/, and static/) are used when customizing a theme. That&amp;rsquo;s a topic for a different tutorial, so please ignore them for now.&lt;/p&gt;
+
+&lt;h3 id=&#34;generate-the-html-for-the-new-site&#34;&gt;Generate the HTML For the New Site&lt;/h3&gt;
+
+&lt;p&gt;Running the &lt;code&gt;hugo&lt;/code&gt; command with no options will read all the available content and generate the HTML files. It will also copy all static files (that&amp;rsquo;s everything that&amp;rsquo;s not content). Since we have an empty site, it won&amp;rsquo;t do much, but it will do it very quickly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The &amp;ldquo;&lt;code&gt;--verbose&lt;/code&gt;&amp;rdquo; flag gives extra information that will be helpful when we build the template. Every line of the output that starts with &amp;ldquo;INFO:&amp;rdquo; or &amp;ldquo;WARN:&amp;rdquo; is present because we used that flag. The lines that start with &amp;ldquo;WARN:&amp;rdquo; are warning messages. We&amp;rsquo;ll go over them later.&lt;/p&gt;
+
+&lt;p&gt;We can verify that the command worked by looking at the directory again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;See that new public/ directory? Hugo placed all generated content there. When you&amp;rsquo;re ready to publish your web site, that&amp;rsquo;s the place to start. For now, though, let&amp;rsquo;s just confirm that we have what we&amp;rsquo;d expect from a site with no content.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+-rw-r--r-- 1 quoha staff 416 Sep 29 17:02 index.xml
+-rw-r--r-- 1 quoha staff 262 Sep 29 17:02 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo created two XML files, which is standard, but there are no HTML files.&lt;/p&gt;
+
+&lt;h3 id=&#34;test-the-new-site&#34;&gt;Test the New Site&lt;/h3&gt;
+
+&lt;p&gt;Verify that you can run the built-in web server. It will dramatically shorten your development cycle if you do. Start it by running the &amp;ldquo;server&amp;rdquo; command. If it is successful, you will see output similar to the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo server --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Connect to the listed URL (it&amp;rsquo;s on the line that starts with &amp;ldquo;Web Server&amp;rdquo;). If everything is working correctly, you should get a page that shows the following:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;index.xml
+sitemap.xml
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That&amp;rsquo;s a listing of your public/ directory. Hugo didn&amp;rsquo;t create a home page because our site has no content. When there&amp;rsquo;s no index.html file in a directory, the server lists the files in the directory, which is what you should see in your browser.&lt;/p&gt;
+
+&lt;p&gt;Let’s go back and look at those warnings again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+WARN: 2014/09/29 Unable to locate layout: [404.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That second warning is easier to explain. We haven’t created a template to be used to generate “page not found errors.” The 404 message is a topic for a separate tutorial.&lt;/p&gt;
+
+&lt;p&gt;Now for the first warning. It is for the home page. You can tell because the first layout that it looked for was “index.html.” That’s only used by the home page.&lt;/p&gt;
+
+&lt;p&gt;I like that the verbose flag causes Hugo to list the files that it&amp;rsquo;s searching for. For the home page, they are index.html, _default/list.html, and _default/single.html. There are some rules that we&amp;rsquo;ll cover later that explain the names and paths. For now, just remember that Hugo couldn&amp;rsquo;t find a template for the home page and it told you so.&lt;/p&gt;
+
+&lt;p&gt;At this point, you&amp;rsquo;ve got a working installation and site that we can build upon. All that’s left is to add some content and a theme to display it.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-a-new-theme&#34;&gt;Create a New Theme&lt;/h2&gt;
+
+&lt;p&gt;Hugo doesn&amp;rsquo;t ship with a default theme. There are a few available (I counted a dozen when I first installed Hugo) and Hugo comes with a command to create new themes.&lt;/p&gt;
+
+&lt;p&gt;We&amp;rsquo;re going to create a new theme called &amp;ldquo;zafta.&amp;rdquo; Since the goal of this tutorial is to show you how to fill out the files to pull in your content, the theme will not contain any CSS. In other words, ugly but functional.&lt;/p&gt;
+
+&lt;p&gt;All themes have opinions on content and layout. For example, Zafta uses &amp;ldquo;post&amp;rdquo; over &amp;ldquo;blog&amp;rdquo;. Strong opinions make for simpler templates but differing opinions make it tougher to use themes. When you build a theme, consider using the terms that other themes do.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-a-skeleton&#34;&gt;Create a Skeleton&lt;/h3&gt;
+
+&lt;p&gt;Use the hugo &amp;ldquo;new&amp;rdquo; command to create the skeleton of a theme. This creates the directory structure and places empty files for you to fill out.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo new theme zafta
+
+$ ls -l
+total 8
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 archetypes
+-rw-r--r-- 1 quoha staff 82 Sep 29 16:49 config.toml
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 content
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:02 public
+drwxr-xr-x 2 quoha staff 68 Sep 29 16:49 static
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes
+
+$ find themes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 1081 Sep 29 17:31 themes/zafta/LICENSE.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+-rw-r--r-- 1 quoha staff 93 Sep 29 17:31 themes/zafta/theme.toml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.&lt;/p&gt;
+
+&lt;p&gt;Please take a minute to fill out the theme.toml and LICENSE.md files. They&amp;rsquo;re optional, but if you&amp;rsquo;re going to be distributing your theme, it tells the world who to praise (or blame). It&amp;rsquo;s also nice to declare the license so that people will know how they can use the theme.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/theme.toml
+author = &amp;quot;michael d henderson&amp;quot;
+description = &amp;quot;a minimal working template&amp;quot;
+license = &amp;quot;MIT&amp;quot;
+name = &amp;quot;zafta&amp;quot;
+source_repo = &amp;quot;&amp;quot;
+tags = [&amp;quot;tags&amp;quot;, &amp;quot;categories&amp;quot;]
+:wq
+
+## also edit themes/zafta/LICENSE.md and change
+## the bit that says &amp;quot;YOUR_NAME_HERE&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that the the skeleton&amp;rsquo;s template files are empty. Don&amp;rsquo;t worry, we&amp;rsquo;ll be changing that shortly.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/footer.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/partials/header.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-configuration-file-to-use-the-theme&#34;&gt;Update the Configuration File to Use the Theme&lt;/h3&gt;
+
+&lt;p&gt;Now that we&amp;rsquo;ve got a theme to work with, it&amp;rsquo;s a good idea to add the theme name to the configuration file. This is optional, because you can always add &amp;ldquo;-t zafta&amp;rdquo; on all your commands. I like to put it the configuration file because I like shorter command lines. If you don&amp;rsquo;t put it in the configuration file or specify it on the command line, you won&amp;rsquo;t use the template that you&amp;rsquo;re expecting to.&lt;/p&gt;
+
+&lt;p&gt;Edit the file to add the theme, add a title for the site, and specify that all of our content will use the TOML format.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+theme = &amp;quot;zafta&amp;quot;
+baseurl = &amp;quot;&amp;quot;
+languageCode = &amp;quot;en-us&amp;quot;
+title = &amp;quot;zafta - totally refreshing&amp;quot;
+MetaDataFormat = &amp;quot;toml&amp;quot;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;generate-the-site&#34;&gt;Generate the Site&lt;/h3&gt;
+
+&lt;p&gt;Now that we have an empty theme, let&amp;rsquo;s generate the site again.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Did you notice that the output is different? The warning message for the home page has disappeared and we have an additional information line saying that Hugo is syncing from the theme&amp;rsquo;s directory.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s check the public/ directory to see what Hugo&amp;rsquo;s created.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ ls -l public
+total 16
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 css
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:56 index.html
+-rw-r--r-- 1 quoha staff 407 Sep 29 17:56 index.xml
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:56 js
+-rw-r--r-- 1 quoha staff 243 Sep 29 17:56 sitemap.xml
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice four things:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Hugo created a home page. This is the file public/index.html.&lt;/li&gt;
+&lt;li&gt;Hugo created a css/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo created a js/ directory.&lt;/li&gt;
+&lt;li&gt;Hugo claimed that it created 0 pages. It created a file and copied over static files, but didn&amp;rsquo;t create any pages. That&amp;rsquo;s because it considers a &amp;ldquo;page&amp;rdquo; to be a file created directly from a content file. It doesn&amp;rsquo;t count things like the index.html files that it creates automatically.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h4 id=&#34;the-home-page-1&#34;&gt;The Home Page&lt;/h4&gt;
+
+&lt;p&gt;Hugo supports many different types of templates. The home page is special because it gets its own type of template and its own template file. The file, layouts/index.html, is used to generate the HTML for the home page. The Hugo documentation says that this is the only required template, but that depends. Hugo&amp;rsquo;s warning message shows that it looks for three different templates:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;If it can&amp;rsquo;t find any of these, it completely skips creating the home page. We noticed that when we built the site without having a theme installed.&lt;/p&gt;
+
+&lt;p&gt;When Hugo created our theme, it created an empty home page template. Now, when we build the site, Hugo finds the template and uses it to generate the HTML for the home page. Since the template file is empty, the HTML file is empty, too. If the template had any rules in it, then Hugo would have used them to generate the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find . -name index.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 20:21 ./public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 ./themes/zafta/layouts/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;the-magic-of-static&#34;&gt;The Magic of Static&lt;/h4&gt;
+
+&lt;p&gt;Hugo does two things when generating the site. It uses templates to transform content into HTML and it copies static files into the site. Unlike content, static files are not transformed. They are copied exactly as they are.&lt;/p&gt;
+
+&lt;p&gt;Hugo assumes that your site will use both CSS and JavaScript, so it creates directories in your theme to hold them. Remember opinions? Well, Hugo&amp;rsquo;s opinion is that you&amp;rsquo;ll store your CSS in a directory named css/ and your JavaScript in a directory named js/. If you don&amp;rsquo;t like that, you can change the directory names in your theme directory or even delete them completely. Hugo&amp;rsquo;s nice enough to offer its opinion, then behave nicely if you disagree.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -type d | xargs ls -ld
+drwxr-xr-x 7 quoha staff 238 Sep 29 17:38 themes/zafta
+drwxr-xr-x 3 quoha staff 102 Sep 29 17:31 themes/zafta/archetypes
+drwxr-xr-x 5 quoha staff 170 Sep 29 17:31 themes/zafta/layouts
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/_default
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/layouts/partials
+drwxr-xr-x 4 quoha staff 136 Sep 29 17:31 themes/zafta/static
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/css
+drwxr-xr-x 2 quoha staff 68 Sep 29 17:31 themes/zafta/static/js
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;the-theme-development-cycle&#34;&gt;The Theme Development Cycle&lt;/h2&gt;
+
+&lt;p&gt;When you&amp;rsquo;re working on a theme, you will make changes in the theme&amp;rsquo;s directory, rebuild the site, and check your changes in the browser. Hugo makes this very easy:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;Purge the public/ directory.&lt;/li&gt;
+&lt;li&gt;Run the built in web server in watch mode.&lt;/li&gt;
+&lt;li&gt;Open your site in a browser.&lt;/li&gt;
+&lt;li&gt;Update the theme.&lt;/li&gt;
+&lt;li&gt;Glance at your browser window to see changes.&lt;/li&gt;
+&lt;li&gt;Return to step 4.&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;I’ll throw in one more opinion: never work on a theme on a live site. Always work on a copy of your site. Make changes to your theme, test them, then copy them up to your site. For added safety, use a tool like Git to keep a revision history of your content and your theme. Believe me when I say that it is too easy to lose both your mind and your changes.&lt;/p&gt;
+
+&lt;p&gt;Check the main Hugo site for information on using Git with Hugo.&lt;/p&gt;
+
+&lt;h3 id=&#34;purge-the-public-directory&#34;&gt;Purge the public/ Directory&lt;/h3&gt;
+
+&lt;p&gt;When generating the site, Hugo will create new files and update existing ones in the &lt;code&gt;public/&lt;/code&gt; directory. It will not delete files that are no longer used. For example, files that were created in the wrong directory or with the wrong title will remain. If you leave them, you might get confused by them later. I recommend cleaning out your site prior to generating it.&lt;/p&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re building on an SSD, you should ignore this. Churning on a SSD can be costly.&lt;/p&gt;
+
+&lt;h3 id=&#34;hugo-s-watch-option&#34;&gt;Hugo&amp;rsquo;s Watch Option&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s &amp;ldquo;&lt;code&gt;--watch&lt;/code&gt;&amp;rdquo; option will monitor the content/ and your theme directories for changes and rebuild the site automatically.&lt;/p&gt;
+
+&lt;h3 id=&#34;live-reload&#34;&gt;Live Reload&lt;/h3&gt;
+
+&lt;p&gt;Hugo&amp;rsquo;s built in web server supports live reload. As pages are saved on the server, the browser is told to refresh the page. Usually, this happens faster than you can say, &amp;ldquo;Wow, that&amp;rsquo;s totally amazing.&amp;rdquo;&lt;/p&gt;
+
+&lt;h3 id=&#34;development-commands&#34;&gt;Development Commands&lt;/h3&gt;
+
+&lt;p&gt;Use the following commands as the basis for your workflow.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;## purge old files. hugo will recreate the public directory.
+##
+$ rm -rf public
+##
+## run hugo in watch mode
+##
+$ hugo server --watch --verbose
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here&amp;rsquo;s sample output showing Hugo detecting a change to the template for the home page. Once generated, the web browser automatically reloaded the page. I&amp;rsquo;ve said this before, it&amp;rsquo;s amazing.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo server --watch --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+Watching for changes in /Users/quoha/Sites/zafta/content
+Serving pages from /Users/quoha/Sites/zafta/public
+Web Server is available at http://localhost:1313
+Press Ctrl+C to stop
+INFO: 2014/09/29 File System Event: [&amp;quot;/Users/quoha/Sites/zafta/themes/zafta/layouts/index.html&amp;quot;: MODIFY|ATTRIB]
+Change detected, rebuilding site
+
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 1 ms
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;update-the-home-page-template&#34;&gt;Update the Home Page Template&lt;/h2&gt;
+
+&lt;p&gt;The home page is one of a few special pages that Hugo creates automatically. As mentioned earlier, it looks for one of three files in the theme&amp;rsquo;s layout/ directory:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;index.html&lt;/li&gt;
+&lt;li&gt;_default/list.html&lt;/li&gt;
+&lt;li&gt;_default/single.html&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;We could update one of the default templates, but a good design decision is to update the most specific template available. That&amp;rsquo;s not a hard and fast rule (in fact, we&amp;rsquo;ll break it a few times in this tutorial), but it is a good generalization.&lt;/p&gt;
+
+&lt;h3 id=&#34;make-a-static-home-page&#34;&gt;Make a Static Home Page&lt;/h3&gt;
+
+&lt;p&gt;Right now, that page is empty because we don&amp;rsquo;t have any content and we don&amp;rsquo;t have any logic in the template. Let&amp;rsquo;s change that by adding some text to the template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+0 pages created
+0 tags created
+0 categories created
+in 2 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h4 id=&#34;live-reload-1&#34;&gt;Live Reload&lt;/h4&gt;
+
+&lt;p&gt;Note: If you&amp;rsquo;re running the server with the &lt;code&gt;--watch&lt;/code&gt; option, you&amp;rsquo;ll see different content in the file:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;p&amp;gt;hugo says hello!&amp;lt;/p&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;When you use &lt;code&gt;--watch&lt;/code&gt;, the Live Reload script is added by Hugo. Look for live reload in the documentation to see what it does and how to disable it.&lt;/p&gt;
+
+&lt;h3 id=&#34;build-a-dynamic-home-page&#34;&gt;Build a &amp;ldquo;Dynamic&amp;rdquo; Home Page&lt;/h3&gt;
+
+&lt;p&gt;&amp;ldquo;Dynamic home page?&amp;rdquo; Hugo&amp;rsquo;s a static web site generator, so this seems an odd thing to say. I mean let&amp;rsquo;s have the home page automatically reflect the content in the site every time Hugo builds it. We&amp;rsquo;ll use iteration in the template to do that.&lt;/p&gt;
+
+&lt;h4 id=&#34;create-new-posts&#34;&gt;Create New Posts&lt;/h4&gt;
+
+&lt;p&gt;Now that we have the home page generating static content, let&amp;rsquo;s add some content to the site. We&amp;rsquo;ll display these posts as a list on the home page and on their own page, too.&lt;/p&gt;
+
+&lt;p&gt;Hugo has a command to generate a skeleton post, just like it does for sites and themes.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/default.md
+ERROR: 2014/09/29 Unable to Cast &amp;lt;nil&amp;gt; to map[string]interface{}
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;That wasn&amp;rsquo;t very nice, was it?&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;new&amp;rdquo; command uses an archetype to create the post file. Hugo created an empty default archetype file, but that causes an error when there&amp;rsquo;s a theme. For me, the workaround was to create an archetypes file specifically for the post type.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/archetypes/post.md
++++
+Description = &amp;quot;&amp;quot;
+Tags = []
+Categories = []
++++
+:wq
+
+$ find themes/zafta/archetypes -type f | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
+-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
+
+$ hugo --verbose new post/first.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/first.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/first.md
+/Users/quoha/Sites/zafta/content/post/first.md created
+
+$ hugo --verbose new post/second.md
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 attempting to create post/second.md of post
+INFO: 2014/09/29 curpath: /Users/quoha/Sites/zafta/themes/zafta/archetypes/post.md
+INFO: 2014/09/29 creating /Users/quoha/Sites/zafta/content/post/second.md
+/Users/quoha/Sites/zafta/content/post/second.md created
+
+$ ls -l content/post
+total 16
+-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
+-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
+
+$ cat content/post/first.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:54:53-05:00&amp;quot;
+title = &amp;quot;first&amp;quot;
+
++++
+my first post
+
+$ cat content/post/second.md
++++
+Categories = []
+Description = &amp;quot;&amp;quot;
+Tags = []
+date = &amp;quot;2014-09-29T21:57:09-05:00&amp;quot;
+title = &amp;quot;second&amp;quot;
+
++++
+my second post
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;, &amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The output says that it created 2 pages. Those are our new posts:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 78 Sep 29 22:13 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:13 public/post/second/index.html
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;The new files are empty because because the templates used to generate the content are empty. The homepage doesn&amp;rsquo;t show the new content, either. We have to update the templates to add the posts.&lt;/p&gt;
+
+&lt;h3 id=&#34;list-and-single-templates&#34;&gt;List and Single Templates&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, we have three major kinds of templates. There&amp;rsquo;s the home page template that we updated previously. It is used only by the home page. We also have &amp;ldquo;single&amp;rdquo; templates which are used to generate output for a single content file. We also have &amp;ldquo;list&amp;rdquo; templates that are used to group multiple pieces of content before generating output.&lt;/p&gt;
+
+&lt;p&gt;Generally speaking, list templates are named &amp;ldquo;list.html&amp;rdquo; and single templates are named &amp;ldquo;single.html.&amp;rdquo;&lt;/p&gt;
+
+&lt;p&gt;There are three other types of templates: partials, content views, and terms. We will not go into much detail on these.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-homepage&#34;&gt;Add Content to the Homepage&lt;/h3&gt;
+
+&lt;p&gt;The home page will contain a list of posts. Let&amp;rsquo;s update its template to add the posts that we just created. The logic in the template will run every time we build the site.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Hugo uses the Go template engine. That engine scans the template files for commands which are enclosed between &amp;ldquo;{{&amp;rdquo; and &amp;ldquo;}}&amp;rdquo;. In our template, the commands are:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;range&lt;/li&gt;
+&lt;li&gt;.Title&lt;/li&gt;
+&lt;li&gt;end&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;p&gt;The &amp;ldquo;range&amp;rdquo; command is an iterator. We&amp;rsquo;re going to use it to go through the first ten pages. Every HTML file that Hugo creates is treated as a page, so looping through the list of pages will look at every file that will be created.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;.Title&amp;rdquo; command prints the value of the &amp;ldquo;title&amp;rdquo; variable. Hugo pulls it from the front matter in the Markdown file.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;end&amp;rdquo; command signals the end of the range iterator. The engine loops back to the top of the iteration when it finds &amp;ldquo;end.&amp;rdquo; Everything between the &amp;ldquo;range&amp;rdquo; and &amp;ldquo;end&amp;rdquo; is evaluated every time the engine goes through the iteration. In this file, that would cause the title from the first ten pages to be output as heading level one.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s helpful to remember that some variables, like .Data, are created before any output files. Hugo loads every content file into the variable and then gives the template a chance to process before creating the HTML files.&lt;/p&gt;
+
+&lt;p&gt;Build the web site and then verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Congratulations, the home page shows the title of the two posts. The posts themselves are still empty, but let&amp;rsquo;s take a moment to appreciate what we&amp;rsquo;ve done. Your template now generates output dynamically. Believe it or not, by inserting the range command inside of those curly braces, you&amp;rsquo;ve learned everything you need to know to build a theme. All that&amp;rsquo;s really left is understanding which template will be used to generate each content file and becoming familiar with the commands for the template engine.&lt;/p&gt;
+
+&lt;p&gt;And, if that were entirely true, this tutorial would be much shorter. There are a few things to know that will make creating a new template much easier. Don&amp;rsquo;t worry, though, that&amp;rsquo;s all to come.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-content-to-the-posts&#34;&gt;Add Content to the Posts&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;re working with posts, which are in the content/post/ directory. That means that their section is &amp;ldquo;post&amp;rdquo; (and if we don&amp;rsquo;t do something weird, their type is also &amp;ldquo;post&amp;rdquo;).&lt;/p&gt;
+
+&lt;p&gt;Hugo uses the section and type to find the template file for every piece of content. Hugo will first look for a template file that matches the section or type name. If it can&amp;rsquo;t find one, then it will look in the _default/ directory. There are some twists that we&amp;rsquo;ll cover when we get to categories and tags, but for now we can assume that Hugo will try post/single.html, then _default/single.html.&lt;/p&gt;
+
+&lt;p&gt;Now that we know the search rule, let&amp;rsquo;s see what we actually have available:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name single.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 132 Sep 29 17:31 themes/zafta/layouts/_default/single.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;We could create a new template, post/single.html, or change the default. Since we don&amp;rsquo;t know of any other content types, let&amp;rsquo;s start with updating the default.&lt;/p&gt;
+
+&lt;p&gt;Remember, any content that we haven&amp;rsquo;t created a template for will end up using this template. That can be good or bad. Bad because I know that we&amp;rsquo;re going to be adding different types of content and we&amp;rsquo;re going to end up undoing some of the changes we&amp;rsquo;ve made. It&amp;rsquo;s good because we&amp;rsquo;ll be able to see immediate results. It&amp;rsquo;s also good to start here because we can start to build the basic layout for the site. As we add more content types, we&amp;rsquo;ll refactor this file and move logic around. Hugo makes that fairly painless, so we&amp;rsquo;ll accept the cost and proceed.&lt;/p&gt;
+
+&lt;p&gt;Please see the Hugo documentation on template rendering for all the details on determining which template to use. And, as the docs mention, if you&amp;rsquo;re building a single page application (SPA) web site, you can delete all of the other templates and work with just the default single page. That&amp;rsquo;s a refreshing amount of joy right there.&lt;/p&gt;
+
+&lt;h4 id=&#34;update-the-template-file&#34;&gt;Update the Template File&lt;/h4&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 94 Sep 29 22:40 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:40 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
+
+$ cat public/post/first/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;first&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;first&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my first post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$ cat public/post/second/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;second&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;second&amp;lt;/h1&amp;gt;
+ &amp;lt;p&amp;gt;my second post&amp;lt;/p&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the posts now have content. You can go to localhost:1313/post/first to verify.&lt;/p&gt;
+
+&lt;h3 id=&#34;linking-to-content&#34;&gt;Linking to Content&lt;/h3&gt;
+
+&lt;p&gt;The posts are on the home page. Let&amp;rsquo;s add a link from there to the post. Since this is the home page, we&amp;rsquo;ll update its template.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Build the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ rm -rf public
+$ hugo --verbose
+INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
+INFO: 2014/09/29 found taxonomies: map[string]string{&amp;quot;tag&amp;quot;:&amp;quot;tags&amp;quot;, &amp;quot;category&amp;quot;:&amp;quot;categories&amp;quot;}
+WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
+0 draft content
+0 future content
+2 pages created
+0 tags created
+0 categories created
+in 4 ms
+
+$ find public -type f -name &#39;*.html&#39; | xargs ls -l
+-rw-r--r-- 1 quoha staff 149 Sep 29 22:44 public/index.html
+-rw-r--r-- 1 quoha staff 125 Sep 29 22:44 public/post/first/index.html
+-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
+-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
+
+$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/second/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;/post/first/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+
+$
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;create-a-post-listing&#34;&gt;Create a Post Listing&lt;/h3&gt;
+
+&lt;p&gt;We have the posts displaying on the home page and on their own page. We also have a file public/post/index.html that is empty. Let&amp;rsquo;s make it show a list of all posts (not just the first ten).&lt;/p&gt;
+
+&lt;p&gt;We need to decide which template to update. This will be a listing, so it should be a list template. Let&amp;rsquo;s take a quick look and see which list templates are available.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find themes/zafta -name list.html | xargs ls -l
+-rw-r--r-- 1 quoha staff 0 Sep 29 17:31 themes/zafta/layouts/_default/list.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As with the single post, we have to decide to update _default/list.html or create post/list.html. We still don&amp;rsquo;t have multiple content types, so let&amp;rsquo;s stay consistent and update the default list template.&lt;/p&gt;
+
+&lt;h2 id=&#34;creating-top-level-pages&#34;&gt;Creating Top Level Pages&lt;/h2&gt;
+
+&lt;p&gt;Let&amp;rsquo;s add an &amp;ldquo;about&amp;rdquo; page and display it at the top level (as opposed to a sub-level like we did with posts).&lt;/p&gt;
+
+&lt;p&gt;The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let&amp;rsquo;s verify that by creating an &amp;ldquo;about&amp;rdquo; page at the top level:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi content/about.md
++++
+title = &amp;quot;about&amp;quot;
+description = &amp;quot;about this site&amp;quot;
+date = &amp;quot;2014-09-27&amp;quot;
+slug = &amp;quot;about time&amp;quot;
++++
+
+## about us
+
+i&#39;m speechless
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:08 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 527 Sep 27 15:08 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:08 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:08 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:08 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the page wasn&amp;rsquo;t created at the top level. It was created in a sub-directory named &amp;lsquo;about-time/&amp;rsquo;. That name came from our slug. Hugo will use the slug to name the generated content. It&amp;rsquo;s a reasonable default, by the way, but we can learn a few things by fighting it for this file.&lt;/p&gt;
+
+&lt;p&gt;One other thing. Take a look at the home page.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ cat public/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/theme/&amp;quot;&amp;gt;creating a new theme&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/about-time/&amp;quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/second-post/&amp;quot;&amp;gt;second&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+ &amp;lt;h1&amp;gt;&amp;lt;a href=&amp;quot;http://localhost:1313/post/first-post/&amp;quot;&amp;gt;first&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;
+&amp;lt;script&amp;gt;document.write(&#39;&amp;lt;script src=&amp;quot;http://&#39;
+ + (location.host || &#39;localhost&#39;).split(&#39;:&#39;)[0]
+ + &#39;:1313/livereload.js?mindelay=10&amp;quot;&amp;gt;&amp;lt;/&#39;
+ + &#39;script&amp;gt;&#39;)&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice that the &amp;ldquo;about&amp;rdquo; link is listed with the posts? That&amp;rsquo;s not desirable, so let&amp;rsquo;s change that first.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;body&amp;gt;
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if eq .Type &amp;quot;page&amp;quot; }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The home page has two sections, posts and pages, and each section has the right set of headings and links in it.&lt;/p&gt;
+
+&lt;p&gt;But, that about page still renders to about-time/index.html.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ find public -name &#39;*.html&#39; | xargs ls -l
+-rw-rw-r-- 1 mdhender staff 334 Sep 27 15:33 public/about-time/index.html
+-rw-rw-r-- 1 mdhender staff 645 Sep 27 15:33 public/index.html
+-rw-rw-r-- 1 mdhender staff 358 Sep 27 15:33 public/post/first-post/index.html
+-rw-rw-r-- 1 mdhender staff 0 Sep 27 15:33 public/post/index.html
+-rw-rw-r-- 1 mdhender staff 342 Sep 27 15:33 public/post/second-post/index.html
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Knowing that hugo is using the slug to generate the file name, the simplest solution is to change the slug. Let&amp;rsquo;s do it the hard way and change the permalink in the configuration file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi config.toml
+[permalinks]
+ page = &amp;quot;/:title/&amp;quot;
+ about = &amp;quot;/:filename/&amp;quot;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify that this didn&amp;rsquo;t work. Hugo lets &amp;ldquo;slug&amp;rdquo; or &amp;ldquo;URL&amp;rdquo; override the permalinks setting in the configuration file. Go ahead and comment out the slug in content/about.md, then generate the web site to get it to be created in the right place.&lt;/p&gt;
+
+&lt;h2 id=&#34;sharing-templates&#34;&gt;Sharing Templates&lt;/h2&gt;
+
+&lt;p&gt;If you&amp;rsquo;ve been following along, you probably noticed that posts have titles in the browser and the home page doesn&amp;rsquo;t. That&amp;rsquo;s because we didn&amp;rsquo;t put the title in the home page&amp;rsquo;s template (layouts/index.html). That&amp;rsquo;s an easy thing to do, but let&amp;rsquo;s look at a different option.&lt;/p&gt;
+
+&lt;p&gt;We can put the common bits into a shared template that&amp;rsquo;s stored in the themes/zafta/layouts/partials/ directory.&lt;/p&gt;
+
+&lt;h3 id=&#34;create-the-header-and-footer-partials&#34;&gt;Create the Header and Footer Partials&lt;/h3&gt;
+
+&lt;p&gt;In Hugo, a partial is a sugar-coated template. Normally a template reference has a path specified. Partials are different. Hugo searches for them along a TODO defined search path. This makes it easier for end-users to override the theme&amp;rsquo;s presentation.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/partials/header.html
+&amp;lt;!DOCTYPE html&amp;gt;
+&amp;lt;html&amp;gt;
+&amp;lt;head&amp;gt;
+ &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&amp;lt;/head&amp;gt;
+&amp;lt;body&amp;gt;
+:wq
+
+$ vi themes/zafta/layouts/partials/footer.html
+&amp;lt;/body&amp;gt;
+&amp;lt;/html&amp;gt;
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;update-the-home-page-template-to-use-the-partials&#34;&gt;Update the Home Page Template to Use the Partials&lt;/h3&gt;
+
+&lt;p&gt;The most noticeable difference between a template call and a partials call is the lack of path:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;theme/partials/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;versus&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ partial &amp;quot;header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Both pass in the context.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s change the home page template to use these new partials.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/index.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;posts&amp;lt;/h1&amp;gt;
+ {{ range first 10 .Data.Pages }}
+ {{ if eq .Type &amp;quot;post&amp;quot;}}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Title }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+ &amp;lt;h1&amp;gt;pages&amp;lt;/h1&amp;gt;
+ {{ range .Data.Pages }}
+ {{ if or (eq .Type &amp;quot;page&amp;quot;) (eq .Type &amp;quot;about&amp;quot;) }}
+ &amp;lt;h2&amp;gt;&amp;lt;a href=&amp;quot;{{ .Permalink }}&amp;quot;&amp;gt;{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;
+ {{ end }}
+ {{ end }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the home page is now &amp;ldquo;your title here&amp;rdquo;, which comes from the &amp;ldquo;title&amp;rdquo; variable in the config.toml file.&lt;/p&gt;
+
+&lt;h3 id=&#34;update-the-default-single-template-to-use-the-partials&#34;&gt;Update the Default Single Template to Use the Partials&lt;/h3&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The title on the posts and the about page should both reflect the value in the markdown file.&lt;/p&gt;
+
+&lt;h2 id=&#34;add-date-published-to-posts&#34;&gt;Add “Date Published” to Posts&lt;/h2&gt;
+
+&lt;p&gt;It&amp;rsquo;s common to have posts display the date that they were written or published, so let&amp;rsquo;s add that. The front matter of our posts has a variable named &amp;ldquo;date.&amp;rdquo; It&amp;rsquo;s usually the date the content was created, but let&amp;rsquo;s pretend that&amp;rsquo;s the value we want to display.&lt;/p&gt;
+
+&lt;h3 id=&#34;add-date-published-to-the-template&#34;&gt;Add “Date Published” to the Template&lt;/h3&gt;
+
+&lt;p&gt;We&amp;rsquo;ll start by updating the template used to render the posts. The template code will look like:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Posts use the default single template, so we&amp;rsquo;ll change that file.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Generate the web site and verify the results. The posts now have the date displayed in them. There&amp;rsquo;s a problem, though. The &amp;ldquo;about&amp;rdquo; page also has the date displayed.&lt;/p&gt;
+
+&lt;p&gt;As usual, there are a couple of ways to make the date display only on posts. We could do an &amp;ldquo;if&amp;rdquo; statement like we did on the home page. Another way would be to create a separate template for posts.&lt;/p&gt;
+
+&lt;p&gt;The &amp;ldquo;if&amp;rdquo; solution works for sites that have just a couple of content types. It aligns with the principle of &amp;ldquo;code for today,&amp;rdquo; too.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s assume, though, that we&amp;rsquo;ve made our site so complex that we feel we have to create a new template type. In Hugo-speak, we&amp;rsquo;re going to create a section template.&lt;/p&gt;
+
+&lt;p&gt;Let&amp;rsquo;s restore the default single template before we forget.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ mkdir themes/zafta/layouts/post
+$ vi themes/zafta/layouts/_default/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Now we&amp;rsquo;ll update the post&amp;rsquo;s version of the single template. If you remember Hugo&amp;rsquo;s rules, the template engine will use this version over the default.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;$ vi themes/zafta/layouts/post/single.html
+{{ partial &amp;quot;header.html&amp;quot; . }}
+
+ &amp;lt;h1&amp;gt;{{ .Title }}&amp;lt;/h1&amp;gt;
+ &amp;lt;h2&amp;gt;{{ .Date.Format &amp;quot;Mon, Jan 2, 2006&amp;quot; }}&amp;lt;/h2&amp;gt;
+ {{ .Content }}
+
+{{ partial &amp;quot;footer.html&amp;quot; . }}
+:wq
+
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Note that we removed the date logic from the default template and put it in the post template. Generate the web site and verify the results. Posts have dates and the about page doesn&amp;rsquo;t.&lt;/p&gt;
+
+&lt;h3 id=&#34;don-t-repeat-yourself&#34;&gt;Don&amp;rsquo;t Repeat Yourself&lt;/h3&gt;
+
+&lt;p&gt;DRY is a good design goal and Hugo does a great job supporting it. Part of the art of a good template is knowing when to add a new template and when to update an existing one. While you&amp;rsquo;re figuring that out, accept that you&amp;rsquo;ll be doing some refactoring. Hugo makes that easy and fast, so it&amp;rsquo;s okay to delay splitting up a template.&lt;/p&gt;
+</description>
+
</item>
<item>
@@ -27,8 +1121,346 @@ We&amp;rsquo;ll start with creating a new site with a very basic template.</desc
<pubDate>Wed, 02 Apr 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/goisforlovers/</guid>
- <description>Hugo uses the excellent go html/template 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.
-This document is a brief primer on using go templates.</description>
+
+ <description>
+
+&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; 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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
+provide more details.&lt;/p&gt;
+
+&lt;h2 id=&#34;introduction-to-go-templates&#34;&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 &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;
+
+&lt;p&gt;Go lang 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;
+
+&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;
+
+&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
+template is passed either a page or a node struct depending on which type of
+page you are rendering. More details are available on the
+&lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;
+
+&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
+{{ $address }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
+
+&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
+template system also provides a mechanism for applications to extend the
+available functions with their own. &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/functions&#34;&gt;Hugo template
+functions&lt;/a&gt; provide some additional functionality we believe
+are useful for building websites. Functions are called by using their name
+followed by the required parameters separated by spaces. Template
+functions cannot be added without recompiling hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;
+
+&lt;p&gt;When including another template you will pass to it the data it will be
+able to access. To pass along the current context please remember to
+include a trailing dot. The templates location will always be starting at
+the /layout/ directory within Hugo.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;
+
+&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;
+
+&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;
+
+&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
+a map, array or slice. The following are different examples of how to use
+range.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ range array }}
+ {{ . }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $element := array}}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
+ {{ $index }}
+ {{ $element }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;
+
+&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
+logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;false&lt;/li&gt;
+&lt;li&gt;0&lt;/li&gt;
+&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{else}}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;
+
+&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent.&lt;/p&gt;
+
+&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
+ {{ index .Params &amp;quot;alt&amp;quot; }}
+{{ else if isset .Params &amp;quot;caption&amp;quot; }}
+ {{ index .Params &amp;quot;caption&amp;quot; }}
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;
+
+&lt;p&gt;One of the most powerful components of go templates is the ability to
+stack actions one after another. This is done by using pipes. Borrowed
+from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
+input of the following pipe.&lt;/p&gt;
+
+&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
+to being able to chain together function calls. One limitation of the
+pipes is that they only can work with a single value and that value
+becomes the last parameter of the next pipeline.&lt;/p&gt;
+
+&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is the same as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
+illustration of how to use the pipes.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Could be rewritten as&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{ isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
+Stuff Here
+{{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;
+
+&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
+always refers to the current context. In the top level of your template this
+will be the data set made available to it. Inside of a iteration it will have
+the value of the current item. When inside of a loop the context has changed. .
+will no longer refer to the data available to the entire page. If you need to
+access this from within the loop you will likely want to set it to a variable
+instead of depending on the context.&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ $title := .Site.Title }}
+ {{ range .Params.tags }}
+ &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
+have defined a variable outside of the loop so we have access to it from within
+the loop.&lt;/p&gt;
+
+&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;
+
+&lt;p&gt;Hugo provides the option of passing values to the template language
+through the site configuration (for sitewide values), or through the meta
+data of each specific piece of content. You can define any values of any
+type (supported by your front matter/config format) and use them however
+you want to inside of your templates.&lt;/p&gt;
+
+&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In each piece of content you can provide variables to be used by the
+templates. This happens in the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;An example of this is used in this documentation site. Most of the pages
+benefit from having the table of contents provided. Sometimes the TOC just
+doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
+of some pages to turn off the TOC from being displayed.&lt;/p&gt;
+
+&lt;p&gt;Here is the example front matter:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;---
+title: &amp;quot;Permalinks&amp;quot;
+date: &amp;quot;2013-11-18&amp;quot;
+aliases:
+ - &amp;quot;/doc/permalinks/&amp;quot;
+groups: [&amp;quot;extras&amp;quot;]
+groups_weight: 30
+notoc: true
+---
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt; {{ if not .Params.notoc }}
+ &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
+ {{ .TableOfContents }}
+ &amp;lt;/div&amp;gt;
+ {{ end }}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;
+
+&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
+parameters, which are values which will be available to you in chrome.&lt;/p&gt;
+
+&lt;p&gt;For instance, you might declare:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
+ CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
+ TwitterUser: &amp;quot;spf13&amp;quot;
+ SidebarRecentLimit: 5
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
+provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
+you would declare it to be HTML-safe, so that the HTML entity is not escaped
+again. This would let you easily update just your top-level config file each
+January 1st, instead of hunting through your templates.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
+&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
+&amp;lt;/footer&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
+is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
+and skips the block if the variable is absent:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
+&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
+&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
+ alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
+&amp;lt;/span&amp;gt;{{end}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
+so, such as in this example:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
+ &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
+ &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
+ &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
+ {{end}}&amp;lt;/ul&amp;gt;
+&amp;lt;/nav&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</description>
+
</item>
<item>
@@ -37,9 +1469,177 @@ This document is a brief primer on using go templates.</description>
<pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate>
<guid>http://en.xianmin.org/hugo-theme-jane/post/migrate-from-jekyll/</guid>
- <description>Move static content to static Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
-▾ &amp;lt;root&amp;gt;/ ▾ images/ logo.png should become
-▾ &amp;lt;root&amp;gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.</description>
+
+ <description>
+
+&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
+With Jekyll, something that looked like&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;should become&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
+ ▾ static/
+ ▾ images/
+ logo.png
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;
+
+&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;
+
+&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;
+
+&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;
+
+&lt;ol&gt;
+&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;git submodule deinit _site
+git rm _site
+git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+
+&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{
+ ..
+ &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
+ ..
+}
+&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
+&lt;/ol&gt;
+
+&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;
+
+&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;
+
+&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;
+
+&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;
+
+&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;http://en.xianmin.org/hugo-theme-jane/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;
+
+&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;
+
+&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;
+
+&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;module Jekyll
+ class ImageTag &amp;lt; Liquid::Tag
+ @url = nil
+ @caption = nil
+ @class = nil
+ @link = nil
+ // Patterns
+ IMAGE_URL_WITH_CLASS_AND_CAPTION =
+ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
+ IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
+ IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
+ IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
+ def initialize(tag_name, markup, tokens)
+ super
+ if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
+ @class = $1
+ @url = $3
+ @caption = $7
+ @link = $9
+ elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
+ @class = $1
+ @url = $3
+ @caption = $7
+ elsif markup =~ IMAGE_URL_WITH_CAPTION
+ @url = $1
+ @caption = $5
+ elsif markup =~ IMAGE_URL_WITH_CLASS
+ @class = $1
+ @url = $3
+ elsif markup =~ IMAGE_URL
+ @url = $1
+ end
+ end
+ def render(context)
+ if @class
+ source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
+ else
+ source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
+ end
+ if @link
+ source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
+ if @link
+ source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
+ end
+ source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
+ source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
+ source
+ end
+ end
+end
+Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
+&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
+ {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
+ &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
+ {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
+ {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
+ &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
+ {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
+ {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
+ {{ .Get &amp;quot;caption&amp;quot; }}
+ {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
+ {{ .Get &amp;quot;attr&amp;quot; }}
+ {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
+ &amp;lt;/p&amp;gt; {{ end }}
+ &amp;lt;/figcaption&amp;gt;
+ {{ end }}
+&amp;lt;/figure&amp;gt;
+&amp;lt;!-- image --&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;
+
+&lt;p&gt;I simply changed:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
+&lt;/code&gt;&lt;/pre&gt;
+
+&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;
+
+&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;
+
+&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;
+
+&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;
+
+&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;
+
+&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;
+
+&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
+</description>
+
</item>
</channel>