Files
hugo-theme-stack/layouts/list.html
T
JimmyandGitHub bc54cecf0a refactor: centralize page filtering logic, and allow sort by lastmod (#1250)
* refactor: migrate page visibility control from `Params.hidden` to the new `build.list` parameter.

* refactor: centralize page filtering logic into a new `helper/pages.html` partial

* feat: introduce `SortBy` parameter to enable sorting pages by last modified date

* refactor: extract page sorting logic into a new `pages-sort.html` partial
2026-01-27 12:34:15 +01:00

69 lines
2.3 KiB
HTML

{{ define "main" }}
<header>
<h3 class="section-title">
{{ if eq .Parent (.GetPage "/") }}
{{ T "list.section" }}
{{ else }}
{{ .Parent.Title }}
{{ end }}
</h3>
<div class="section-card">
<div class="section-details">
<h3 class="section-count">{{ T "list.page" (len .Pages) }}</h3>
<h1 class="section-term">{{ .Title }}</h1>
{{ with .Params.description }}
<h2 class="section-description">{{ . }}</h2>
{{ end }}
</div>
{{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) -}}
{{ if $image }}
<div class="section-image">
<img src="{{ $image.Permalink }}"
width="{{ $image.Width }}"
height="{{ $image.Height }}"
loading="lazy">
</div>
{{ end }}
</div>
</header>
{{- $pages := partial "helper/pages.html" . -}}
{{- $subsections := .Sections -}}
{{- if and (eq (len $pages) (len $subsections)) (eq $pages $subsections) -}}
{{- $subsections = slice -}}
{{- end -}}
{{- with $subsections -}}
<aside>
<h2 class="section-title">{{ T "list.subsection" (len $subsections) }}</h2>
<div class="subsection-list">
<div class="article-list--tile">
{{ range . }}
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "section") }}
{{ end }}
</div>
</div>
</aside>
{{- end -}}
{{/* List only pages that are not a subsection */}}
{{ $paginator := partial "helper/paginator.html" . }}
{{ with $paginator }}
<section class="article-list--compact">
{{ range .Pages }}
{{ partial "article-list/compact" . }}
{{ end }}
</section>
{{ end }}
{{- partial "pagination.html" . -}}
{{ partialCached "footer/footer" . }}
{{ end }}
{{ define "right-sidebar" }}
{{ partial "sidebar/right.html" (dict "Context" . "Scope" "homepage") }}
{{ end }}