mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-12-26 04:04:29 +01:00
Alan Orth
884713fc2a
Add categories/tags to front matter and they will be displayed on summary and post pages, with links to taxonomy pages. Example: +++ date = "2016-09-24T21:28:31+03:00" title = "Post title" categories = ["Nature"] tags = ["Wetland", "Oasis"] +++ For some reason if you add tags singularly, like: categories = "Nature" you get index errors from Hugo. Not sure if I need to parse the tags differently or just add more logic to test if the terms are singular or not.
7 lines
527 B
HTML
7 lines
527 B
HTML
{{ if .Params.categories }}
|
|
<i class="fa fa-folder" aria-hidden="true"></i> {{ range $index, $category := .Params.categories }}{{ if gt $index 0 }}, {{ end }}<a href="{{ "/categories/" | relURL }}{{ . | urlize }}" rel="category tag">{{ . }}</a>{{ end }}
|
|
{{ end }}
|
|
{{ if .Params.tags }}
|
|
<i class="fa fa-tag" aria-hidden="true"></i> {{ range $index, $tag := .Params.tags }}{{ if gt $index 0 }}, {{ end }}<a href="{{ "/tags/" | relURL }}{{ . | urlize }}" rel="tag">{{ . }}</a>{{ end }}
|
|
{{ end }}
|