From 0280cbf618db38255e878fc4b1bd474223782696 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 17 Apr 2026 16:02:40 +0200 Subject: feat: implement Related Articles sidebar widget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../danix-xyz-hacker/layouts/partials/sidebar.html | 35 +++++++++++++++++----- 1 file changed, 28 insertions(+), 7 deletions(-) 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 }} -- cgit v1.2.3