hugo-PaperMod icon indicating copy to clipboard operation
hugo-PaperMod copied to clipboard

[Feature Request] List all articles of a series

Open marioortizmanero opened this issue 3 years ago • 1 comments

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):

image

marioortizmanero avatar Jul 07 '21 17:07 marioortizmanero

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>,&#32;
        {{- .Date.Format .Site.Params.DateFormat -}}
      </li>
    {{- end }}
    </ol>
{{- end }}
  • Create a layouts/_default folder.
  • Copy themes/papermod/layouts/_default/single.html to layouts/_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"]

hannagoodbar avatar Dec 18 '21 04:12 hannagoodbar