]> danix's work - danix.xyz-2.git/commitdiff
fix: use dedicated article-card partial for taxonomy pages
authorDanilo M. <redacted>
Tue, 21 Apr 2026 10:09:53 +0000 (12:09 +0200)
committerDanilo M. <redacted>
Tue, 21 Apr 2026 10:09:53 +0000 (12:09 +0200)
The timeline partial (article-list-item.html) always emits <li> with
timeline connector and node markup — calling it with . still produces
the same timeline HTML. Created article-card.html with the original
<article class="card"> markup and wired taxonomy templates to use it.

Co-Authored-By: Claude Haiku 4.5 <redacted>
themes/danix-xyz-hacker/layouts/partials/article-card.html [new file with mode: 0644]
themes/danix-xyz-hacker/layouts/taxonomy/list.html
themes/danix-xyz-hacker/layouts/taxonomy/term.html

diff --git a/themes/danix-xyz-hacker/layouts/partials/article-card.html b/themes/danix-xyz-hacker/layouts/partials/article-card.html
new file mode 100644 (file)
index 0000000..0f5cfb9
--- /dev/null
@@ -0,0 +1,92 @@
+{{ $articleType := .Params.type | default "life" }}
+{{ $typeConfig := .Site.Params.articleTypes }}
+{{ $typeData := index $typeConfig $articleType }}
+{{ $excerpt := .Description | default .Summary }}
+
+{{ $imageURL := "" }}
+{{ $useDefaultThumbnail := false }}
+{{ if .Params.image }}
+  {{ $resource := .Resources.GetMatch .Params.image }}
+  {{ if $resource }}
+    {{ $imageURL = $resource.RelPermalink }}
+  {{ else }}
+    {{ $imageURL = .Params.image }}
+  {{ end }}
+{{ else }}
+  {{ $useDefaultThumbnail = true }}
+{{ end }}
+
+<article class="card group bg-bg">
+  <!-- Thumbnail -->
+  {{ if or $imageURL $useDefaultThumbnail }}
+  <a href="{{ .RelPermalink }}" class="block overflow-hidden bg-surface/50 relative" tabindex="-1">
+    {{ if $useDefaultThumbnail }}
+    <picture>
+      <source srcset="/images/default_thumbnail_light.png" media="(prefers-color-scheme: light)" />
+      <img
+        src="/images/default_thumbnail_dark.png"
+        alt="{{ .Title }}"
+        class="card-image group-hover:scale-105 transition-transform duration-200"
+        loading="lazy"
+      />
+    </picture>
+    {{ else }}
+    <img
+      src="{{ $imageURL }}"
+      alt="{{ .Title }}"
+      class="card-image group-hover:scale-105 transition-transform duration-200"
+      loading="lazy"
+    />
+    {{ end }}
+    <!-- Type badge pill overlay -->
+    {{ if $typeData }}
+    <div
+      class="absolute top-3 right-3 px-3 py-1.5 rounded-full text-xs font-semibold text-white transition-opacity"
+      style="background-color: var(--type-{{ $articleType }});"
+    >
+      {{ i18n $articleType }}
+    </div>
+    {{ end }}
+  </a>
+  {{ end }}
+
+  <!-- Content -->
+  <div class="card-body">
+    <!-- Pinned badge -->
+    {{ if .Params.pinned }}
+    <div class="inline-flex items-center gap-1 px-2 py-1 rounded text-sm font-semibold" style="color: {{ .Site.Params.secondaryAccent }};">
+      📌 PINNED
+    </div>
+    {{ end }}
+
+    <!-- Title -->
+    <h3 class="text-xl font-semibold">
+      <a href="{{ .RelPermalink }}" class="group-hover:text-accent transition-colors">
+        {{ .Title }}
+      </a>
+    </h3>
+
+    <!-- Metadata -->
+    <div class="flex flex-wrap items-center gap-3 text-sm text-text-dim">
+      <time datetime="{{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" }}">
+        {{ .PublishDate.Format "Jan 2, 2006" }}
+      </time>
+    </div>
+
+    <!-- Excerpt -->
+    {{ if $excerpt }}
+    <p class="text-text-dim text-sm line-clamp-3 leading-relaxed">
+      {{ $excerpt | plainify }}
+    </p>
+    {{ end }}
+
+    <!-- CTA Button -->
+    <a
+      href="{{ .RelPermalink }}"
+      class="btn btn-sm mt-2"
+    >
+      {{ i18n "readMore" }}
+      <i data-feather="arrow-right" class="w-4 h-4 ml-2"></i>
+    </a>
+  </div>
+</article>
index cd4945a00de4d45221d36b47b05c7e33ad4bc7e0..c3a4317c016e6f2c945e8702bf1da544d5d96f87 100644 (file)
@@ -21,7 +21,7 @@
     <!-- Pinned posts first -->
     {{ range (sort $pinned "Date" "desc") }}
       <div class="relative">
-        {{ partial "article-list-item.html" . }}
+        {{ partial "article-card.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>
@@ -31,7 +31,7 @@
     <!-- Regular posts -->
     {{ range (sort $unpinned "Date" "desc") }}
       <div class="relative">
-        {{ partial "article-list-item.html" . }}
+        {{ partial "article-card.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>
index 5858f64cade18c974d53e6149f910e1ed337d494..1b953bc39e0b2fda2927496037c692bd08b4b6c3 100644 (file)
 
     <!-- Pinned posts first -->
     {{ range (sort $pinned "Date" "desc") }}
-      {{ partial "article-list-item.html" . }}
+      {{ partial "article-card.html" . }}
     {{ end }}
 
     <!-- Regular posts -->
     {{ range (sort $unpinned "Date" "desc") }}
-      {{ partial "article-list-item.html" . }}
+      {{ partial "article-card.html" . }}
     {{ end }}
 
     <!-- Empty state -->