Closed matt-dray closed 5 years ago
Outcome when the following is added to themes/hugo-lithium-theme/layouts/_default/single.html
<div class="article-meta">
<p class="terms">
{{ range $i := (slice "categories" "tags") }}
{{ with ($.Param $i) }}
{{ $i | title }}:
{{ range $k := . }}
<a href='{{ relURL (print "/" $i "/" $k | urlize) }}'>{{$k}}</a>
{{ end }}
{{ end }}
{{ end }}
</p>
</div>
Results from:
{{ if eq .Section "post" }}
<span class="article-date">
{{ .Params.author }} / {{ .Date.Format "02 Jan 2006" }} / {{ .ReadingTime }} min read <br>
{{ range $i := (slice "categories" "tags") }}
{{ with ($.Param $i) }}
{{ $i | title }}:
{{ range $k := . }}
<a href='{{ relURL (print "/" $i "/" $k | urlize) }}'>{{$k}}</a>
{{ end }}
{{ end }}
{{ end }}
</span>
{{ end }}
Pretty sure that'll do.
{{ if eq .Section "post" }}
<span class="article-date">
{{ .Params.author }} / {{ .Date.Format "02 Jan 2006" }} / {{ .ReadingTime }} min read <br>
{{ range $i := (slice "categories" "tags") }}
{{ with ($.Param $i) }}
{{ $i | title }}:
{{ range $k := . }}
<a href='{{ relURL (print "/" $i "/" $k | urlize) }}'>{{ $k }}</a>
{{ end }}<br>
{{ end }}
{{ end }}
</span>
Bullet called 'Display categories and tags in a post if provided in its YAML' in the Creating Websites with RMarkdown book: https://bookdown.org/yihui/blogdown/templates.html#how-to
~Possibly have a standalone page with the tags/categories listed.~ Clicking a link in the example below takes you to a page listing all the posts that share that category/tag.
Related to #14 I reckon.