refactor: centralize pagination logic (#1227)
* refactor: centralize pagination logic into a new helper partial used for page titles and index display * fix: list.html does not exclude hidden pages * refactor: Simplify title generation logic
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
|
||||
{{- $subsections := .Sections -}}
|
||||
{{- $pages := .Pages | complement $subsections -}}
|
||||
{{- $pages = where $pages "Params.hidden" "!=" true -}}
|
||||
|
||||
{{- if eq (len $pages) 0 -}}
|
||||
{{/* If there are no normal pages, display subsections in list style, with pagination */}}
|
||||
@@ -68,12 +69,14 @@
|
||||
{{- end -}}
|
||||
|
||||
{{/* List only pages that are not a subsection */}}
|
||||
{{ $paginator := .Paginate $pages }}
|
||||
<section class="article-list--compact">
|
||||
{{ range $paginator.Pages }}
|
||||
{{ partial "article-list/compact" . }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ $paginator := partial "helper/paginator.html" . }}
|
||||
{{ with $paginator }}
|
||||
<section class="article-list--compact">
|
||||
{{ range .Pages }}
|
||||
{{ partial "article-list/compact" . }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{- partial "pagination.html" . -}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user