diff options
-rw-r--r-- | archetypes/post.md | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 3 | ||||
-rw-r--r-- | layouts/partials/categories.html | 4 | ||||
-rw-r--r-- | layouts/post/single.html | 4 |
4 files changed, 9 insertions, 3 deletions
diff --git a/archetypes/post.md b/archetypes/post.md index 67ec913..c9ca8e8 100644 --- a/archetypes/post.md +++ b/archetypes/post.md @@ -5,4 +5,5 @@ publishdate: {{ now.Format "2006-01-02" }} lastmod: {{ now.Format "2006-01-02" }} draft: true tags: [] +categories: [] --- diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1795e21..9b7c494 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -5,6 +5,7 @@ theme = "minimal-bootstrap-hugo-theme" [taxonomies] tag = "tags" + category = "categories" [permalinks] post = "/:filename/" @@ -77,4 +78,4 @@ theme = "minimal-bootstrap-hugo-theme" tabWidth = 4 [markup.tableOfContents] endLevel = 6 - startLevel = 2
\ No newline at end of file + startLevel = 2 diff --git a/layouts/partials/categories.html b/layouts/partials/categories.html new file mode 100644 index 0000000..85ebf1d --- /dev/null +++ b/layouts/partials/categories.html @@ -0,0 +1,4 @@ +{{ range .Params.categories }} +{{ $href := print (absURL "categories/") (urlize .) }} +<small><code>[<a href="{{ $href }}">{{ . }}</a>]</code></small> +{{ end }} diff --git a/layouts/post/single.html b/layouts/post/single.html index 9e34d6c..d59e499 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -7,8 +7,8 @@ {{ with .Site.Params.customDateFormat }}{{ $customDateFormat = . }}{{ end }} {{ .PublishDate.Format $customDateFormat }}{{ if gt .Lastmod .PublishDate }}, updated {{ .Lastmod.Format $customDateFormat }}{{ end }} </small> - {{ partial "tags" . }} + {{ partial "tags" . }} {{ partial "categories" . }} </p> {{ .Content }} -{{- end -}}
\ No newline at end of file +{{- end -}} |