From: Danilo M. Date: Fri, 17 Apr 2026 14:02:40 +0000 (+0200) Subject: feat: implement Related Articles sidebar widget X-Git-Tag: release_22042026-1342~116 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=0280cbf618db38255e878fc4b1bd474223782696;p=danix.xyz-2.git feat: implement Related Articles sidebar widget Replaces stub implementation with full related content functionality: - Uses Hugo's .Site.RegularPages.Related API for smart tagging - Caps at 5 related articles to keep sidebar compact - Shows 2-line compact card per entry (title + date, excerpt snippet) - Left border colored by article type (var(--type-)) - Includes empty state message when no related articles found - Multilingual support via existing i18n keys - Theme-aware styling via CSS custom properties The widget shows: - Line 1: Title (linked) + · Jan 2006 date inline - Line 2: First ~10 words of excerpt, small font, muted Previously was a stub with empty placeholder comment. Co-Authored-By: Claude Haiku 4.5 --- diff --git a/themes/danix-xyz-hacker/layouts/partials/sidebar.html b/themes/danix-xyz-hacker/layouts/partials/sidebar.html index f552df9..574eb85 100644 --- a/themes/danix-xyz-hacker/layouts/partials/sidebar.html +++ b/themes/danix-xyz-hacker/layouts/partials/sidebar.html @@ -9,14 +9,35 @@ {{ if .Site.Params.relatedPosts }} - {{ $related := .GetTerms "tags" }} - {{ if $related }} -
+ {{ $related := first 5 (.Site.RegularPages.Related .) }} +

{{ i18n "relatedPosts" }}

-
- -
+ {{ if $related }} + + {{ else }} +

{{ i18n "noRelated" }}

+ {{ end }}
{{ end }} - {{ end }}