]> danix's work - danix.xyz-2.git/commitdiff
feat: create articles list with pinned post support
authorDanilo M. <redacted>
Wed, 15 Apr 2026 13:48:54 +0000 (15:48 +0200)
committerDanilo M. <redacted>
Wed, 15 Apr 2026 13:48:54 +0000 (15:48 +0200)
themes/danix-xyz-hacker/layouts/_default/list.html [new file with mode: 0644]

diff --git a/themes/danix-xyz-hacker/layouts/_default/list.html b/themes/danix-xyz-hacker/layouts/_default/list.html
new file mode 100644 (file)
index 0000000..6baeaca
--- /dev/null
@@ -0,0 +1,31 @@
+{{ define "main" }}
+<div class="mx-auto px-4 py-12 max-w-4xl">
+  <!-- Page title -->
+  <h1 class="text-4xl md:text-5xl font-bold text-accent mb-12">
+    {{ .Title }}
+  </h1>
+
+  <!-- Articles list -->
+  <div class="space-y-2 max-w-2xl">
+    {{ $pinned := where .Pages "Params.pinned" true }}
+    {{ $unpinned := where .Pages "Params.pinned" false }}
+
+    <!-- Pinned posts first -->
+    {{ range ($pinned | .ByDate.Reverse) }}
+      {{ partial "article-list-item.html" . }}
+    {{ end }}
+
+    <!-- Regular posts -->
+    {{ range ($unpinned | .ByDate.Reverse) }}
+      {{ partial "article-list-item.html" . }}
+    {{ end }}
+
+    <!-- Empty state -->
+    {{ if eq (len .Pages) 0 }}
+      <div class="py-12 text-center text-text-dim">
+        {{ i18n "noRelated" }}
+      </div>
+    {{ end }}
+  </div>
+</div>
+{{ end }}