### Build the site and verify output
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Commands to clean the public directory, rebuild the site, and list the generated HTML files.
```bash
$ 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{"category":"categories", "tag":"tags"}
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
$
```
```bash
$ find public -type f -name '*.html' | 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
$
```
--------------------------------
### Build and verify homepage links
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Rebuild the site and verify the generated homepage links.
```bash
$ 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{"tag":"tags", "category":"categories"}
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 '*.html' | 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
$
```
--------------------------------
### Create an about page
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Define a new content file with front matter including title, description, date, and slug.
```markdown
$ vi content/about.md
+++
title = "about"
description = "about this site"
date = "2014-09-27"
slug = "about time"
+++
## about us
i'm speechless
:wq
```
--------------------------------
### Configure post archetype and verify creation
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Create a specific archetype for posts to resolve generation errors and verify the resulting file structure.
```bash
$ vi themes/zafta/archetypes/post.md
+++
Description = ""
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 = ""
Tags = []
date = "2014-09-29T21:54:53-05:00"
title = "first"
+++
my first post
$ cat content/post/second.md
+++
Categories = []
Description = ""
Tags = []
date = "2014-09-29T21:57:09-05:00"
title = "second"
+++
my second post
$
```
--------------------------------
### Build and verify site output
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Rebuild the Hugo site and inspect the generated HTML files.
```bash
$ 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{"tag":"tags", "category":"categories"}
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 '*.html' | 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
first
first
my first post
$ cat public/post/second/index.html
second
second
my second post
$
```
--------------------------------
### Create Header and Footer Partials
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Defines the header and footer partials in the theme's partials directory.
```bash
$ vi themes/zafta/layouts/partials/header.html
{{ .Title }}
:wq
$ vi themes/zafta/layouts/partials/footer.html
:wq
```
--------------------------------
### Build and Verify Hugo Site
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Commands to clean the public directory, build the site with verbose logging, and inspect the generated HTML files.
```bash
$ 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{"tag":"tags", "category":"categories"}
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 '*.html' | 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
second
first
$
```
--------------------------------
### Compare Template and Partial Calls
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Shows the syntax difference between a standard template call and a partial call in Hugo.
```go-template
{{ template "theme/partials/header.html" . }}
```
```go-template
{{ partial "header.html" . }}
```
--------------------------------
### Inspect home page source
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
View the generated home page HTML to verify link structure.
```html
$ cat public/index.html
```
--------------------------------
### Locate list templates
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Use the find command to identify existing list templates within the theme directory.
```bash
$ 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
```
--------------------------------
### Verify generated HTML files
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
List the generated HTML files in the public directory to inspect the output structure.
```bash
$ find public -name '*.html' | 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
```
```bash
$ find public -name '*.html' | 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
```
--------------------------------
### Generate a new post with Hugo
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Command to create a new post file using the Hugo CLI.
```bash
$ 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 to map[string]interface{}
$
```
--------------------------------
### Configure permalinks
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Update the configuration file to define custom URL structures for pages.
```toml
$ vi config.toml
[permalinks]
page = "/:title/"
about = "/:filename/"
```
--------------------------------
### Inspect live reload output
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Displays the index.html content when the --watch flag is enabled, showing the injected livereload script.
```bash
$ cat public/index.html
hugo says hello!
```
--------------------------------
### Update Home Page Template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Updates the index layout to utilize the newly created header and footer partials.
```bash
$ vi themes/zafta/layouts/index.html
{{ partial "header.html" . }}
posts
{{ range first 10 .Data.Pages }}
{{ if eq .Type "post"}}
{{ end }}
{{ end }}
pages
{{ range .Data.Pages }}
{{ if or (eq .Type "page") (eq .Type "about") }}
{{ end }}
{{ end }}
{{ partial "footer.html" . }}
:wq
```
--------------------------------
### Create Post-Specific Single Template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Defines a custom template for the post section to display the date.
```bash
$ vi themes/zafta/layouts/post/single.html
{{ partial "header.html" . }}
{{ .Title }}
{{ .Date.Format "Mon, Jan 2, 2006" }}
{{ .Content }}
{{ partial "footer.html" . }}
:wq
```
--------------------------------
### Locate single.html template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Use find to identify the location of the default single page template.
```bash
$ 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
```
--------------------------------
### Update Default Single Template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Modifies the default single layout to include the formatted date.
```bash
$ vi themes/zafta/layouts/_default/single.html
{{ partial "header.html" . }}
{{ .Title }}
{{ .Date.Format "Mon, Jan 2, 2006" }}
{{ .Content }}
{{ partial "footer.html" . }}
:wq
```
--------------------------------
### Update Default Single Template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Updates the default single page layout to include the header and footer partials.
```bash
$ vi themes/zafta/layouts/_default/single.html
{{ partial "header.html" . }}
{{ .Title }}
{{ .Content }}
{{ partial "footer.html" . }}
:wq
```
--------------------------------
### Restore Default Single Template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Reverts the default single template to its original state after creating a specific post layout.
```bash
$ mkdir themes/zafta/layouts/post
$ vi themes/zafta/layouts/_default/single.html
{{ partial "header.html" . }}
{{ .Title }}
{{ .Content }}
{{ partial "footer.html" . }}
:wq
```
--------------------------------
### Format Date in Hugo Template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Displays the post date in a specific format within a Hugo template.
```go-html-template
{{ .Date.Format "Mon, Jan 2, 2006" }}
```
--------------------------------
### Update index.html template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Modify the homepage template to iterate over pages and create links.
```bash
$ vi themes/zafta/layouts/index.html
{{ range first 10 .Data.Pages }}
{{ end }}
```
--------------------------------
### Update single.html template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Edit the default single page template to include title and content placeholders.
```bash
$ vi themes/zafta/layouts/_default/single.html
{{ .Title }}
{{ .Title }}
{{ .Content }}
:wq
$
```
--------------------------------
### Update index template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Modify the index layout to separate posts and pages into distinct sections.
```html
$ vi themes/zafta/layouts/index.html
posts
{{ range first 10 .Data.Pages }}
{{ if eq .Type "post"}}
{{ end }}
{{ end }}
pages
{{ range .Data.Pages }}
{{ if eq .Type "page" }}
{{ end }}
{{ end }}
:wq
```
--------------------------------
### Update Hugo Index Template
Source: https://github.com/acmerobotics/road-runner/blob/master/road-runner-docs/site/themes/hugo-book/exampleSite/content.en/posts/creating-a-new-theme.md
Modifies the index.html template to iterate over the first 10 pages and display their titles.
```html
$ vi themes/zafta/layouts/index.html
{{ range first 10 .Data.Pages }}
{{ .Title }}
{{ end }}
:wq
$
```