Show page position in series on series taxonomy pages

Fix #40
This commit is contained in:
BBaoVanC 2021-11-23 13:14:44 -06:00
parent 161c68d16c
commit 55bbfa90e4
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
4 changed files with 46 additions and 1 deletions

View File

@ -78,6 +78,12 @@
background-color: var(--background-2); background-color: var(--background-2);
} }
.post-series-position {
position: relative;
float: right;
opacity: .75;
}
.post-title { .post-title {
margin-bottom: 10px; margin-bottom: 10px;
} }

View File

@ -28,8 +28,13 @@
<div class="series-pages"> <div class="series-pages">
<ul> <ul>
{{ $i := 0 }}
{{ $total := len .Data.Pages }}
{{ range .Data.Pages.Reverse }} {{ range .Data.Pages.Reverse }}
<li>{{ .Render "summary/post" }}</li> {{ $i = add 1 $i }}
{{ .Scratch.Set "series_position" $i }}
{{ .Scratch.Set "series_total" $total }}
<li>{{ .Render "summary/series_post" }}</li>
{{ end }} {{ end }}
</ul> </ul>
</div> </div>

View File

@ -0,0 +1,29 @@
<div class="post">
<div class="post-series-position">
{{ if .Scratch.Get "series_position" }}
({{ .Scratch.Get "series_position" }}/{{ .Scratch.Get "series_total" }})
{{ end }}
</div>
<h2 class="post-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "post-metadata/short.html" . }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" . "border" true) }}
</div>
{{ end }}
<div class="post-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>
</div>

View File

@ -9,7 +9,12 @@
<div class="page-list"> <div class="page-list">
<ul> <ul>
{{ $i := 0 }}
{{ $total := len .Pages }}
{{ range .Paginator.Pages.Reverse }} {{ range .Paginator.Pages.Reverse }}
{{ $i = add 1 $i }}
{{ .Scratch.Set "series_position" $i }}
{{ .Scratch.Set "series_total" $total }}
<li>{{ .Render "summary/post" }}</li> <li>{{ .Render "summary/post" }}</li>
{{ else }} {{ else }}
<div> <div>