feat: show categories on posts (#973)
## Summary
* Add a `categories.html` partial that renders linked Hugo `categories`
terms with the same styling pattern used for tags.
* Include categories before tags on single pages.
## Motivation
Posts already show tags, but Hugo also supports `categories` as a
taxonomy. This resolves the requested single-page category display from
issue #620.
Closes #620
## Documentation
Documentation PR: gohugo-ananke/documentation#18
## Verification
* Compared `issues/620` against `development`; the branch is ahead by
only the intended two files.
* Confirmed `layouts/_partials/tags.html` already renders terms with
`.GetTerms "tags"`, and the new categories partial mirrors that approach
with `.GetTerms "categories"`.
* Could not run a local Hugo build because the execution container
cannot resolve `github.com` for repository cloning or dependency
installation.
2 files modified
1 files added
| | |
| | | [ananke] |
| | | show_recent_posts = true # show recent posts on the homepage |
| | | show_categories = true # show categories terms on single pages |
| | | |
| | | [ananke.home] |
| | | content_alignment = "center" # options: left, center, right |
| New file |
| | |
| | | {{- /* Show category terms on single pages unless disabled via site.Params.ananke.show_categories = false */ -}} |
| | | {{- if not (eq false site.Params.ananke.show_categories) -}} |
| | | <ul class="pa0"> |
| | | {{ range .GetTerms "categories" }} |
| | | <li class="list di"> |
| | | <a href="{{ .RelPermalink }}" class="link f5 grow br-pill ba ph3 pv2 mb2 dib black sans-serif no-underline"> |
| | | {{- .LinkTitle -}} |
| | | </a> |
| | | </li> |
| | | {{ end }} |
| | | </ul> |
| | | {{- end -}} |
| | |
| | | {{- partials.Include "hook.html" (dict "hook" "content-before" "context" .) -}} |
| | | {{- .Content -}} |
| | | {{- partials.Include "hook.html" (dict "hook" "content-after" "context" .) -}} |
| | | {{- partials.Include "categories.html" . -}} |
| | | {{- partials.Include "tags.html" . -}} |
| | | {{ if .Site.Config.Services.Disqus.Shortname }} |
| | | <div class="mt6 instapaper_ignoref"> |