]> danix's work - danix.xyz-2.git/commitdiff
fix: show Related Articles widget only on articles, not pages
authorDanilo M. <redacted>
Fri, 17 Apr 2026 14:04:29 +0000 (16:04 +0200)
committerDanilo M. <redacted>
Fri, 17 Apr 2026 14:04:29 +0000 (16:04 +0200)
Add type check: widget now only renders when .Type == 'articles'
Pages in the 'is' section won't show the related widget.

Co-Authored-By: Claude Haiku 4.5 <redacted>
themes/danix-xyz-hacker/layouts/partials/sidebar.html

index 574eb85cd497110ed2de36d801b0039ede157327..0d1b8028d5b2a05ee73ea369c4c58bf3a56b8486 100644 (file)
@@ -7,8 +7,8 @@
     </p>
   </div>
 
-  <!-- Related posts widget (optional) -->
-  {{ if .Site.Params.relatedPosts }}
+  <!-- Related posts widget (articles only) -->
+  {{ if and .Site.Params.relatedPosts (eq .Type "articles") }}
   {{ $related := first 5 (.Site.RegularPages.Related .) }}
   <div class="p-4 border border-border/30 rounded mb-6">
     <h3 class="text-lg font-semibold text-accent mb-3">{{ i18n "relatedPosts" }}</h3>