summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-04-28 21:08:56 +0200
committerDanilo M. <danix@danix.xyz>2026-04-28 21:08:56 +0200
commit8baed345eb1489f378db1a5e0768b25c7c25659a (patch)
treebfd79897ef54bd66b1af617903e0cb88822fee13 /layouts
parent78aec78d7c5977ee4367093b1fd6910e6c6b6cb4 (diff)
downloaddanixxyz-theme-8baed345eb1489f378db1a5e0768b25c7c25659a.tar.gz
danixxyz-theme-8baed345eb1489f378db1a5e0768b25c7c25659a.zip
feat: expand author widget to article stats (words, reading time, type)
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/sidebar.html45
1 files changed, 40 insertions, 5 deletions
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index a2225f1..2db058f 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -1,10 +1,45 @@
<aside class="order-last md:order-none md:col-span-1">
- <!-- Author info widget (optional - can be expanded) -->
+ <!-- Article stats widget -->
<div class="sidebar-widget">
- <p class="sidebar-widget-label"># {{ i18n "author" }}</p>
- <p class="text-text-dim text-sm leading-relaxed">
- {{ .Site.Params.author }}
- </p>
+ <p class="sidebar-widget-label"># {{ i18n "articleStats" }}</p>
+
+ {{ if .Params.image }}
+ <img
+ src="{{ .Params.image }}"
+ alt="{{ .Title }}"
+ loading="lazy"
+ class="w-full rounded mb-4 object-cover max-h-40"
+ >
+ {{ end }}
+
+ <ul class="space-y-2 text-sm text-text-dim">
+ <li class="flex items-center gap-2">
+ <i data-feather="user" class="w-4 h-4 shrink-0"></i>
+ <span>{{ .Site.Params.author }}</span>
+ </li>
+ <li class="flex items-center gap-2">
+ <i data-feather="file-text" class="w-4 h-4 shrink-0"></i>
+ <span>{{ .WordCount }} {{ i18n "words" }}</span>
+ </li>
+ {{ if .Site.Params.readingTime }}
+ <li class="flex items-center gap-2">
+ <i data-feather="clock" class="w-4 h-4 shrink-0"></i>
+ <span>{{ .ReadingTime }} {{ i18n "min" }} {{ i18n "readingTime" }}</span>
+ </li>
+ {{ end }}
+ {{ $articleType := .Params.type | default "" }}
+ {{ $typeConfig := .Site.Params.articleTypes }}
+ {{ $typeData := index $typeConfig $articleType }}
+ {{ if and $typeData $articleType }}
+ <li class="flex items-center gap-2">
+ <i data-feather="tag" class="w-4 h-4 shrink-0"></i>
+ <span
+ class="inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-semibold"
+ style="background-color: var(--type-{{ $articleType }}); color: var(--type-{{ $articleType }}-text);"
+ >{{ i18n $articleType }}</span>
+ </li>
+ {{ end }}
+ </ul>
</div>
<hr class="sidebar-hr">