hugo-PaperMod
hugo-PaperMod copied to clipboard
[Feature Request] List all articles of a series
PaperMod includes by default the taxonomy "series". It would be great if, when in an article that is part of a series, it indicated so, and listed the rest of the articles. For example (https://fasterthanli.me/series/making-our-own-executable-packer/part-1):
I did something similar adapted from https://npf.io/2014/08/making-it-a-series/.
- Under your site create a
layouts/partials
folder. - Create the file
layouts/partial/series-posts.html
with these contents.
{{/* From: https://npf.io/2014/08/making-it-a-series/ */}}
{{- if .Params.series }}
{{- $name := index .Params.series 0 }}
<p><a href="" id="series"></a>Part of the <em>{{$name}}</em> series:</p>
{{- $name := $name | urlize }}
{{- $series := index .Site.Taxonomies.series $name }}
<ol reversed class="series">
{{- range $series.Pages }}
<li><a href="{{.Permalink}}">{{.LinkTitle}}</a>, 
{{- .Date.Format .Site.Params.DateFormat -}}
</li>
{{- end }}
</ol>
{{- end }}
- Create a
layouts/_default
folder. - Copy
themes/papermod/layouts/_default/single.html
tolayouts/_default/single.html
. - Edit
layouts/_default/singlehtml
. In my copy, I put the following in the footer section, just underneath<footer class="post-footer">
.
{{- if .Params.series }}
{{- partial "series-posts.html" . -}}
{{- end }}
- To use, include the following in your post's front matter.
series: ["Making our own executable packer"]