Open melroy89 opened 1 year ago
Yes - curious on how this can be done. When a post is added, the tags show at the bottom - how can the category also show?
Figured it out. This can be further modified to customize the look.
Added a new partial under layouts/partials called "categories.html" with the below code:
<ul class="pa0">
{{ range .GetTerms "categories" }}
<li class="list di">
<b>Categories: </b><a href="{{ .RelPermalink }}" class="link f5 grow no-underline br-pill ba ph3 pv2 mb2 dib black sans-serif">
{{- .LinkTitle -}}
</a>
</li>
{{ end }}
</ul>
Then in layouts/_default, modified single.html by adding the categories above the {{ Content }} like this:
{{- partial "categories.html" . -}}
Now the categories show up on the posts.
You only list the tags of the Hugo posts. But Hugo also supports
categories
as taxonomies. Could you please also show them when viewing the post?Example of the markdown page section with
categories
: