diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-21 11:44:10 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-21 11:44:10 +0200 |
| commit | 79f839d80a292d0b733277a35a0c3c2412dd3a9b (patch) | |
| tree | 64312783ede34821598189df79c146168df6f75c /themes | |
| parent | 46ce86242815f5051c15fefda733853ca59ef1a3 (diff) | |
| download | danixxyz-79f839d80a292d0b733277a35a0c3c2412dd3a9b.tar.gz danixxyz-79f839d80a292d0b733277a35a0c3c2412dd3a9b.zip | |
feat: use timeline container in taxonomy list and term templates
Diffstat (limited to 'themes')
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/taxonomy/list.html | 61 | ||||
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/taxonomy/term.html | 51 |
2 files changed, 51 insertions, 61 deletions
diff --git a/themes/danix-xyz-hacker/layouts/taxonomy/list.html b/themes/danix-xyz-hacker/layouts/taxonomy/list.html index cd4945a..7fd06ab 100644 --- a/themes/danix-xyz-hacker/layouts/taxonomy/list.html +++ b/themes/danix-xyz-hacker/layouts/taxonomy/list.html @@ -1,49 +1,40 @@ {{ define "main" }} -<div class="mx-auto px-4 py-12 max-w-4xl"> +<div class="mx-auto px-4 py-12 max-w-5xl"> <!-- Page title with taxonomy name --> <h1 class="text-4xl md:text-5xl font-bold text-accent mb-12"> {{ i18n .Data.Plural }} </h1> - <!-- Articles list --> - <div class="space-y-6 max-w-3xl"> - {{ $pinned := where .Pages "Params.pinned" true }} - {{ $unpinned := where .Pages "Params.pinned" false }} + {{ $pinned := where .Pages "Params.pinned" true }} + {{ $unpinned := where .Pages "Params.pinned" false }} - <!-- If no unpinned posts found (because param is undefined), get all non-pinned pages --> + <!-- If no unpinned posts found (because param is undefined), get all non-pinned pages --> + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" nil }} {{ if eq (len $unpinned) 0 }} - {{ $unpinned = where .Pages "Params.pinned" nil }} - {{ if eq (len $unpinned) 0 }} - {{ $unpinned = where .Pages "Params.pinned" "" }} - {{ end }} + {{ $unpinned = where .Pages "Params.pinned" "" }} {{ end }} + {{ end }} - <!-- Pinned posts first --> - {{ range (sort $pinned "Date" "desc") }} - <div class="relative"> - {{ partial "article-list-item.html" . }} - <span class="absolute top-4 right-4 px-2 py-0.5 rounded text-xs font-mono bg-surface text-text-dim border border-border/30"> - {{ i18n "postCount" .Pages.Len }} - </span> - </div> + {{ if eq (len .Pages) 0 }} + <div class="py-12 text-center text-text-dim"> + {{ i18n "noRelated" }} + </div> + {{ else }} + <ol class="timeline" aria-label="{{ i18n .Data.Plural }}"> + {{ range $i, $page := (sort $pinned "Date" "desc") }} + {{ $side := "left" }} + {{ if eq (mod $i 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }} + {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }} {{ end }} - - <!-- Regular posts --> - {{ range (sort $unpinned "Date" "desc") }} - <div class="relative"> - {{ partial "article-list-item.html" . }} - <span class="absolute top-4 right-4 px-2 py-0.5 rounded text-xs font-mono bg-surface text-text-dim border border-border/30"> - {{ i18n "postCount" .Pages.Len }} - </span> - </div> + {{ $offset := len $pinned }} + {{ range $i, $page := (sort $unpinned "Date" "desc") }} + {{ $idx := add $i $offset }} + {{ $side := "left" }} + {{ if eq (mod $idx 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }} + {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }} {{ end }} - - <!-- Empty state --> - {{ if eq (len .Pages) 0 }} - <div class="py-12 text-center text-text-dim"> - {{ i18n "noRelated" }} - </div> - {{ end }} - </div> + </ol> + {{ end }} </div> {{ end }} diff --git a/themes/danix-xyz-hacker/layouts/taxonomy/term.html b/themes/danix-xyz-hacker/layouts/taxonomy/term.html index 5858f64..a96e107 100644 --- a/themes/danix-xyz-hacker/layouts/taxonomy/term.html +++ b/themes/danix-xyz-hacker/layouts/taxonomy/term.html @@ -1,5 +1,5 @@ {{ define "main" }} -<div class="mx-auto px-4 py-12 max-w-4xl"> +<div class="mx-auto px-4 py-12 max-w-5xl"> <!-- Page title with taxonomy type --> <h1 class="text-4xl md:text-5xl font-bold text-accent mb-2"> {{ i18n .Data.Singular }} @@ -12,35 +12,34 @@ </span> </p> - <!-- Articles list --> - <div class="space-y-6 max-w-3xl"> - {{ $pinned := where .Pages "Params.pinned" true }} - {{ $unpinned := where .Pages "Params.pinned" false }} - - <!-- If no unpinned posts found (because param is undefined), get all non-pinned pages --> + {{ $pinned := where .Pages "Params.pinned" true }} + {{ $unpinned := where .Pages "Params.pinned" false }} + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" nil }} {{ if eq (len $unpinned) 0 }} - {{ $unpinned = where .Pages "Params.pinned" nil }} - {{ if eq (len $unpinned) 0 }} - {{ $unpinned = where .Pages "Params.pinned" "" }} - {{ end }} - {{ end }} - - <!-- Pinned posts first --> - {{ range (sort $pinned "Date" "desc") }} - {{ partial "article-list-item.html" . }} + {{ $unpinned = where .Pages "Params.pinned" "" }} {{ end }} + {{ end }} - <!-- Regular posts --> - {{ range (sort $unpinned "Date" "desc") }} - {{ partial "article-list-item.html" . }} + {{ if eq (len .Pages) 0 }} + <div class="py-12 text-center text-text-dim"> + {{ i18n "noRelated" }} + </div> + {{ else }} + <ol class="timeline" aria-label="{{ .Title }}"> + {{ range $i, $page := (sort $pinned "Date" "desc") }} + {{ $side := "left" }} + {{ if eq (mod $i 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }} + {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }} {{ end }} - - <!-- Empty state --> - {{ if eq (len .Pages) 0 }} - <div class="py-12 text-center text-text-dim"> - {{ i18n "noRelated" }} - </div> + {{ $offset := len $pinned }} + {{ range $i, $page := (sort $unpinned "Date" "desc") }} + {{ $idx := add $i $offset }} + {{ $side := "left" }} + {{ if eq (mod $idx 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }} + {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }} {{ end }} - </div> + </ol> + {{ end }} </div> {{ end }} |
