Spent a few hours using search (Google and here) to get a handle on why using the techniques here for related posts aren’t working for Hugo Book theme. My guess is there is an implied bit I’m missing in the instructions.
Hugo version: v0.73.0-428907CC/extended linux/amd64
Theme: Hugo Book theme
My /layouts/posts/single.html
{{ define "main" }}
<article class="markdown">
<h1>
{{ .Title }}
</h1>
{{ partial "docs/breadcrumbs.html" . }}
{{ partial "docs/post-meta" . }}
<p>
{{- .Content -}}
</p>{{- range .Params.authors }}
{{- with $.Site.GetPage "taxonomyTerm" (printf "authors/%s" (urlize .)) }}
<hr class="new4">
<div class="move">
<img src="/imgs/me.png" alt=""/>
<h3>Written By <a href="https://www.matthartley.com/" target="_blank">Matt Hartley</a></h3>
{{ .Content }}
{{ with .Params.twitter }}
<p>
<a href="https://twitter.com/{{ substr . 1 }}">
Follow {{ $.Params.name }} on Twitter
</a></br></br><hr class="new4"></div>
</p>
{{ end }}
{{ end }}
{{ end }}
</article>
{{ $related := .Site.RegularPages.RelatedTo ( keyVals "Development") ( keyVals "date" .Date ) }}
{{ end }}
{{ define "toc" }}
{{ partial "docs/toc" . }}
{{ end }}
my /layouts/partials/docs/related.html
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<h3>See Also</h3>
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
What I’m trying to accomplish:
- I’d like to have related posts appear below the single blog post’s contents.
- I’d like related posts to be based on either category or keyword.
Many thank you(s)