Skip to content

Commit

Permalink
Closes #22
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydan2 committed Dec 31, 2019
2 parents a2f861d + 854702d commit d4aaf9d
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 120 deletions.
3 changes: 2 additions & 1 deletion archetypes/default.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
+++
title = "{{ replace .TranslationBaseName "-" " " | title }}"
date = {{ .Date }}
draft = true
images = []
tags = []
categories = []
draft = true
+++
5 changes: 3 additions & 2 deletions archetypes/posts.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
+++
title = "{{ replace .TranslationBaseName "-" " " | title }}"
date = {{ .Date }}
draft = true
images = []
tags = []
categories = []
+++
draft = true
+++
147 changes: 73 additions & 74 deletions exampleSite/content/posts/creating-a-new-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ author: "Michael Henderson"
date: 2014-09-28
linktitle: Creating a New Theme
title: Creating a New Theme
image : ""
---


Expand Down Expand Up @@ -145,13 +144,13 @@ 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 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
$
$
```

The "`--verbose`" flag gives extra information that will be helpful when we build the template. Every line of the output that starts with "INFO:" or "WARN:" is present because we used that flag. The lines that start with "WARN:" are warning messages. We'll go over them later.
Expand All @@ -177,7 +176,7 @@ $ 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
$
$
```

Hugo created two XML files, which is standard, but there are no HTML files.
Expand All @@ -194,9 +193,9 @@ 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 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
Expand Down Expand Up @@ -264,7 +263,7 @@ $ find themes -type f | xargs ls -l
-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
$
$
```

The skeleton includes templates (the files ending in .html), license file, a description of your theme (the theme.toml file), and an empty archetype.
Expand Down Expand Up @@ -327,9 +326,9 @@ 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 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
Expand Down Expand Up @@ -374,7 +373,7 @@ When Hugo created our theme, it created an empty home page template. Now, when w
$ 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
$
$
```

#### The Magic of Static
Expand All @@ -393,7 +392,7 @@ 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
$
$
```

## The Theme Development Cycle
Expand Down Expand Up @@ -449,9 +448,9 @@ 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 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
Expand All @@ -463,9 +462,9 @@ INFO: 2014/09/29 File System Event: ["/Users/quoha/Sites/zafta/themes/zafta/layo
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 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 1 ms
Expand All @@ -487,12 +486,12 @@ Right now, that page is empty because we don't have any content and we don't hav

```
$ vi themes/zafta/layouts/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
</body>
</html>
:wq
$
Expand All @@ -506,21 +505,21 @@ 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 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
$ find public -type f -name '*.html' | xargs ls -l
-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
</html>
```

Expand All @@ -529,15 +528,15 @@ $ cat public/index.html
Note: If you're running the server with the `--watch` option, you'll see different content in the file:

```
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
<script>document.write('<script src="http://'
+ (location.host || 'localhost').split(':')[0]
+ ':1313/livereload.js?mindelay=10"></'
+ 'script>')</script></body>
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
<script>document.write('<script src="http://'
+ (location.host || 'localhost').split(':')[0]
+ ':1313/livereload.js?mindelay=10"></'
+ 'script>')</script></body>
</html>
```

Expand All @@ -560,7 +559,7 @@ 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 <nil> to map[string]interface{}
$
$
```

That wasn't very nice, was it?
Expand Down Expand Up @@ -599,7 +598,7 @@ 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
$ cat content/post/first.md
+++
Categories = []
Description = ""
Expand All @@ -610,7 +609,7 @@ title = "first"
+++
my first post
$ cat content/post/second.md
$ cat content/post/second.md
+++
Categories = []
Description = ""
Expand All @@ -621,7 +620,7 @@ title = "second"
+++
my second post
$
$
```

Build the web site and then verify the results.
Expand All @@ -634,9 +633,9 @@ INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /
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 draft content
0 future content
2 pages created
0 tags created
0 categories created
in 4 ms
Expand Down Expand Up @@ -669,7 +668,7 @@ There are three other types of templates: partials, content views, and terms. We
The home page will contain a list of posts. Let'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.

```
$ vi themes/zafta/layouts/index.html
$ vi themes/zafta/layouts/index.html
<!DOCTYPE html>
<html>
<body>
Expand Down Expand Up @@ -707,26 +706,26 @@ INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /
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 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
$ 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
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<h1>second</h1>
<h1>first</h1>
</body>
</html>
$
Expand Down Expand Up @@ -758,7 +757,7 @@ Please see the Hugo documentation on template rendering for all the details on d
#### Update the Template File

```
$ vi themes/zafta/layouts/_default/single.html
$ vi themes/zafta/layouts/_default/single.html
<!DOCTYPE html>
<html>
<head>
Expand All @@ -784,9 +783,9 @@ INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /
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 draft content
0 future content
2 pages created
0 tags created
0 categories created
in 4 ms
Expand All @@ -797,7 +796,7 @@ $ find public -type f -name '*.html' | xargs ls -l
-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
$ cat public/post/first/index.html
<!DOCTYPE html>
<html>
<head>
Expand All @@ -810,7 +809,7 @@ $ cat public/post/first/index.html
</body>
</html>
$ cat public/post/second/index.html
$ cat public/post/second/index.html
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -853,9 +852,9 @@ INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /
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 draft content
0 future content
2 pages created
0 tags created
0 categories created
in 4 ms
Expand All @@ -866,15 +865,15 @@ $ find public -type f -name '*.html' | xargs ls -l
-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
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<h1><a href="/post/second/">second</a></h1>
<h1><a href="/post/first/">first</a></h1>
</body>
</html>
Expand All @@ -901,7 +900,7 @@ Let's add an "about" page and display it at the top level (as opposed to a sub-l
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's verify that by creating an "about" page at the top level:

```
$ vi content/about.md
$ vi content/about.md
+++
title = "about"
description = "about this site"
Expand Down
11 changes: 11 additions & 0 deletions exampleSite/content/posts/feature-image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+++
title = "Feature Image"
date = 2020-01-01
images = ["http://via.placeholder.com/600x200"]
tags = ["Feature Image", "Layout"]
categories = ["Images"]
+++

The Hugo Kiera theme now supports featured images. To use the feature, set the `images` parameter in a page's frontmatter.

(Note that this is required to be an array, even though only the first image is used. This is to provide compatability with the built-in [Twitter Card](https://gohugo.io/templates/internal/#twitter-cards) shortcode.)
Loading

0 comments on commit d4aaf9d

Please sign in to comment.