I am trying to provide a set of links for post series using a taxonomy series
.
The basics are working, but I can’t get the data selector correct for showing the links in either the page or a widget.
In the page I have a series_list.html
partial as follows…
{{ if .Params.series }}
{{ $series := index .Params.series 0 }}
{{ $taxonomy := index .Site.Taxonomies.series $series }}
<section id="menu">
{{ partial "series_top.html" . }}
{{ $num := 0 }}
<ul>
{{ range $taxonomy.Pages.ByDate }}
{{ $num = add $num 1 }}
{{ if eq .Permalink $.Page.Permalink }}
<li hugo-nav="{{ .RelPermalink}}">Part {{ $num }}: {{ .LinkTitle }}</a></li>
{{ else }}
<li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}">Part {{ $num }}: {{ .LinkTitle }}</a></li>
{{ end }}
{{ end }}
</ul>
</section>
{{end}}
and in the current_series.html
widget I have
{{ if .Params.series }}
{{ $series := index .Params.series 0 }}
{{ $current := index .Site.Taxonomies.series $series }}
<div class="widget-series widget">
<h4 class="widget__title">Series: {{ $series }}</h4>
<div class="widget__content">
<ul class="widget__list">
{{ range $current.Pages.ByDate }}
<li class="widget__item">
<a class="widget__link" href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
</div>
</div>
{{ end }}
I can make it show all the links to all the series, but can’t restrict it to the current series
The sample code is at https://github.com/phatcher/ph-hugo-samples/tree/feature/series