Extract series navigation into a partial

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2024-06-19 21:56:00 -07:00
parent 25e9057dd8
commit db9433bda1
2 changed files with 14 additions and 13 deletions

View File

@ -27,19 +27,7 @@
</div> </div>
{{ end }} {{ end }}
{{ define "after" }} {{ define "after" }}
{{ $term := index (.GetTerms "series") 0 }} {{- partial "seriesnav.html" . -}}
{{ with $term }}
{{- /* No idea why the 'Reverse' is needed? */ -}}
{{ $pages := (site.Taxonomies.series.Get .Data.Term).Pages.ByDate.Reverse }}
<nav id="SeriesNavigation" class="container">
{{ with $pages.Prev page }}
{{ partial "serieslink.html" (dict "direction" "previous" "link" .RelPermalink "page" .) }}
{{ end }}
{{ with $pages.Next page }}
{{ partial "serieslink.html" (dict "direction" "next" "link" .RelPermalink "page" .) }}
{{ end }}
</nav>
{{ end }}
<hr class="container footer-divider"> <hr class="container footer-divider">
<footer class="container"> <footer class="container">
<p>{{ i18n "contactFooter" | safeHTML }}</p> <p>{{ i18n "contactFooter" | safeHTML }}</p>

View File

@ -0,0 +1,13 @@
{{ $term := index (.GetTerms "series") 0 }}
{{ with $term }}
{{- /* No idea why the 'Reverse' is needed? */ -}}
{{ $pages := (site.Taxonomies.series.Get .Data.Term).Pages.ByDate.Reverse }}
<nav id="SeriesNavigation" class="container">
{{ with $pages.Prev page }}
{{ partial "serieslink.html" (dict "direction" "previous" "link" .RelPermalink "page" .) }}
{{ end }}
{{ with $pages.Next page }}
{{ partial "serieslink.html" (dict "direction" "next" "link" .RelPermalink "page" .) }}
{{ end }}
</nav>
{{ end }}