feat(series): серия «Октябрь без слежки» (Opt Out October) + страница всех серий и пункт меню
- 22 поста Opt Out October: series + series_order 1…22 - layouts/partials/series_nav.html: русское имя серии из title термина, «N из M», prev/next - layouts/series/term.html: порядок по series_order, без пагинации - content/series/_index.md («Серии») и content/series/opt-out-october/_index.md («Октябрь без слежки») - terms.html показывает .Title термина, пункт меню «Серии» → /series/ - сборка: hugo --minify --cleanDestinationDir (CI + README + docs), мусорные термины ушли из public/ - openspec change series-opt-out-october
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
series: ["Имя серии"]
|
||||
series_order: 1
|
||||
Выводит блок «Серия: N из M» со ссылками на предыдущую/следующую часть.
|
||||
Отображаемое имя берётся из title страницы серии (content/series/<slug>/_index.md),
|
||||
поэтому серия может иметь латинский slug и русское название.
|
||||
Если серий нет или пост не в серии — выводит пустоту.
|
||||
*/ -}}
|
||||
{{- $series := .Params.series -}}
|
||||
@@ -17,6 +19,7 @@
|
||||
{{- if not $term }}{{- $term = site.GetPage (printf "/series/%s" ($seriesName | lower)) -}}{{- end -}}
|
||||
{{- if $term -}}
|
||||
{{- $pages := (sort $term.Pages "Params.series_order" "asc") -}}
|
||||
{{- $display := $term.Title | default $seriesName -}}
|
||||
{{- $current := $.Params.series_order -}}
|
||||
{{- $total := $pages | len -}}
|
||||
{{- $idx := 0 -}}
|
||||
@@ -25,18 +28,23 @@
|
||||
{{- range $i, $p := $pages -}}
|
||||
{{- if eq $current $p.Params.series_order -}}
|
||||
{{- $idx = add $i 1 -}}
|
||||
{{- $prev = (index $pages (sub $i 1)) | default "" -}}
|
||||
{{- $next = (index $pages (add $i 1)) | default "" -}}
|
||||
{{- if gt $i 0 }}{{ $prev = (index $pages (sub $i 1)) }}{{ end -}}
|
||||
{{- if lt (add $i 1) $total }}{{ $next = (index $pages (add $i 1)) }}{{ end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<div class="series-nav" data-series="{{ $seriesName }}" data-order="{{ $current }}" data-total="{{ $total }}">
|
||||
<div class="series-title">Серия: <a href="{{ $term.Permalink }}">{{ $seriesName }}</a></div>
|
||||
<div class="series-progress">часть {{ $idx }} из {{ $total }}</div>
|
||||
<div class="series-head">
|
||||
<span class="series-label">Серия</span>
|
||||
<a class="series-title" href="{{ $term.Permalink }}">{{ $display }}</a>
|
||||
<span class="series-progress">{{ $idx }} из {{ $total }}</span>
|
||||
</div>
|
||||
{{- if or $prev $next }}
|
||||
<div class="series-links">
|
||||
{{- if $prev }}<a class="series-prev" href="{{ $prev.Permalink }}">← {{ $prev.Title }}</a>{{- end }}
|
||||
{{- if $next }}<a class="series-next" href="{{ $next.Permalink }}">{{ $next.Title }} →</a>{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user