Add support for series navigation links

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2024-05-20 00:27:25 -07:00
parent f3bf27d4a1
commit e4dccd4f48
3 changed files with 68 additions and 0 deletions

View File

@ -330,6 +330,45 @@ figure {
}
}
#SeriesNavigation {
margin-top: 1em;
display: flex;
.wrapper {
flex-grow: 1;
display: flex;
&.previous {
justify-content: left;
}
&.next {
justify-content: right;
}
}
a {
@include bordered-block;
padding: 0.5em 1em 0.5em 1em;
font-size: 1.1em;
display: flex;
align-items: center;
.feather {
height: 1.25em;
width: 1.25em;
fill: none;
&:first-child { margin-right: 0.5em; }
&:last-child { margin-left: 0.5em; }
}
}
div.title {
font-weight: bold;
}
}
.series-status {
&.suspended { --status-color: #f9b005; }
&.complete { --status-color: #3dc60b; }

View File

@ -27,6 +27,19 @@
</div>
{{ end }}
{{ define "after" }}
{{ $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 "term" $term "page" .) }}
{{ end }}
{{ with $pages.Next page }}
{{ partial "serieslink.html" (dict "direction" "next" "link" .RelPermalink "term" $term "page" .) }}
{{ end }}
</nav>
{{ end }}
<hr class="container footer-divider">
<footer class="container">
<p>{{ i18n "contactFooter" | safeHTML }}</p>

View File

@ -0,0 +1,16 @@
<div class="{{ .direction }} wrapper">
<a href="{{ .link }}">
{{ if eq .direction "previous" }}{{ partial "icon.html" "chevrons-left" }}{{ end }}
<div class="title-subtitle">
{{ title .direction }} in Series
{{ $divider := .term.Params.divider }}
{{ if $divider }}
{{ $rest := after 1 (split .page.Title $divider) }}
<div class="title">{{ delimit $rest $divider }}</div>
{{ else }}
<div class="title">{{ .page.Title }}</div>
{{ end }}
</div>
{{ if eq .direction "next" }}{{ partial "icon.html" "chevrons-right" }}{{ end }}
</a>
</div>