Hi,
I am creating a series section for my own site (no theme) and I have the taxonomy working.
- I can get a list of series that exist with number of articles in each
- For the single page I am able to get “this is article X of Y in the FOO series”
- For the list of articles in FOO series I can get the the series that the article belongs too. But I am not able to get this is article X of Y in the FOO series"
A point in the right direction would be great as the resources I have found on the web just fall short for me being able to resolve this myself.
The relevent snippet in the /layout/_default/single (I have the same in my /layout/_default/list.html) is:
{{- with .Params.series }}
<div>
<i class="fa-solid fa-layer-group"></i>
Series:
{{- range $seriesName := . -}}
{{ with $.Site.GetPage (printf "/%s/%s" "series" $seriesName ) }}
<a class="tag" href="{{ .RelPermalink }}">{{ .Title }}</a>
{{- end }}
{{ $currentSeries := index $.Site.Taxonomies.series ($seriesName | urlize) }}
{{ if $currentSeries }}
{{ $total := len $currentSeries.Pages }}
{{ range $index, $page := $currentSeries.Pages }}
{{ if eq $page.Permalink $.Permalink }}
{{ $articleNumber := add $index 1 }}
(Article {{ $articleNumber }} of {{ $total }})
{{ end }}
{{ end }}
{{ end }}
{{- end }}
</div>
{{- end }}
</div>
{{- end }}
A live version of my site is at
https://mikewebbtech.github.io/mikewebb-tech/series/
and the site repo on GitHub is at
https://github.com/mikewebbtech/mikewebbtech-hugo
Cheers
Mike