summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-04-21 12:09:53 +0200
committerDanilo M. <danix@danix.xyz>2026-04-21 12:09:53 +0200
commita14e39f1e7ca28fd27380efef855617c070ce256 (patch)
tree2971ed0e487c75081b4974328704fd8f02c4f37a
parent60628e3f8e0fca9f19123fcc2148111cc4d8edc1 (diff)
downloaddanixxyz-a14e39f1e7ca28fd27380efef855617c070ce256.tar.gz
danixxyz-a14e39f1e7ca28fd27380efef855617c070ce256.zip
fix: use dedicated article-card partial for taxonomy pages
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 <noreply@anthropic.com>
-rw-r--r--themes/danix-xyz-hacker/layouts/partials/article-card.html92
-rw-r--r--themes/danix-xyz-hacker/layouts/taxonomy/list.html4
-rw-r--r--themes/danix-xyz-hacker/layouts/taxonomy/term.html4
3 files changed, 96 insertions, 4 deletions
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
index 0000000..0f5cfb9
--- /dev/null
+++ b/themes/danix-xyz-hacker/layouts/partials/article-card.html
@@ -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>
diff --git a/themes/danix-xyz-hacker/layouts/taxonomy/list.html b/themes/danix-xyz-hacker/layouts/taxonomy/list.html
index cd4945a..c3a4317 100644
--- a/themes/danix-xyz-hacker/layouts/taxonomy/list.html
+++ b/themes/danix-xyz-hacker/layouts/taxonomy/list.html
@@ -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>
diff --git a/themes/danix-xyz-hacker/layouts/taxonomy/term.html b/themes/danix-xyz-hacker/layouts/taxonomy/term.html
index 5858f64..1b953bc 100644
--- a/themes/danix-xyz-hacker/layouts/taxonomy/term.html
+++ b/themes/danix-xyz-hacker/layouts/taxonomy/term.html
@@ -27,12 +27,12 @@
<!-- 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 -->