diff --git a/_includes/components/blog-sidebar.njk b/_includes/components/blog-sidebar.njk index c108cdb..1b83057 100644 --- a/_includes/components/blog-sidebar.njk +++ b/_includes/components/blog-sidebar.njk @@ -1,6 +1,7 @@ {# Blog Sidebar - Shown on individual post pages #} {# Data-driven when homepageConfig.blogPostSidebar is configured, otherwise falls back to default widgets #} {# Each widget is wrapped in a collapsible container with localStorage persistence #} +{% from "components/icon.njk" import icon %} {% if homepageConfig and homepageConfig.blogPostSidebar and homepageConfig.blogPostSidebar.length %} {# === Data-driven mode: render configured widgets === #} @@ -28,6 +29,41 @@ {% else %}{% set widgetTitle = widget.type %} {% endif %} + {# Resolve widget icon and accent border #} + {% if widget.type == "social-activity" %} + {% set widgetIcon = "globe" %}{% set widgetIconClass = "w-5 h-5 text-[#0085ff]" %}{% set widgetBorder = "border-l-[3px] border-l-[#0085ff]" %} + {% elif widget.type == "github-repos" %} + {% set widgetIcon = "github" %}{% set widgetIconClass = "w-5 h-5 text-surface-800 dark:text-surface-200" %}{% set widgetBorder = "border-l-[3px] border-l-surface-400 dark:border-l-surface-500" %} + {% elif widget.type == "funkwhale" %} + {% set widgetIcon = "headphones" %}{% set widgetIconClass = "w-5 h-5 text-purple-500" %}{% set widgetBorder = "border-l-[3px] border-l-purple-400 dark:border-l-purple-500" %} + {% elif widget.type == "blogroll" %} + {% set widgetIcon = "book-open" %}{% set widgetIconClass = "w-5 h-5 text-amber-500" %}{% set widgetBorder = "border-l-[3px] border-l-amber-400 dark:border-l-amber-500" %} + {% elif widget.type == "feedland" %} + {% set widgetIcon = "rss" %}{% set widgetIconClass = "w-5 h-5 text-amber-500" %}{% set widgetBorder = "border-l-[3px] border-l-amber-400 dark:border-l-amber-500" %} + {% elif widget.type == "subscribe" %} + {% set widgetIcon = "rss" %}{% set widgetIconClass = "w-5 h-5 text-orange-500" %}{% set widgetBorder = "border-l-[3px] border-l-orange-400 dark:border-l-orange-500" %} + {% elif widget.type == "fediverse-follow" %} + {% set widgetIcon = "user-plus" %}{% set widgetIconClass = "w-5 h-5 text-[#a730b8]" %}{% set widgetBorder = "border-l-[3px] border-l-[#a730b8]" %} + {% elif widget.type == "author-card" or widget.type == "author-card-compact" %} + {% set widgetIcon = "user" %}{% set widgetIconClass = "w-5 h-5 text-surface-500" %}{% set widgetBorder = "" %} + {% elif widget.type == "recent-posts" %} + {% set widgetIcon = "list" %}{% set widgetIconClass = "w-5 h-5 text-surface-500" %}{% set widgetBorder = "" %} + {% elif widget.type == "categories" or widget.type == "post-categories" %} + {% set widgetIcon = "tag" %}{% set widgetIconClass = "w-5 h-5 text-surface-500" %}{% set widgetBorder = "" %} + {% elif widget.type == "recent-comments" %} + {% set widgetIcon = "chat" %}{% set widgetIconClass = "w-5 h-5 text-surface-500" %}{% set widgetBorder = "" %} + {% elif widget.type == "search" %} + {% set widgetIcon = "search" %}{% set widgetIconClass = "w-5 h-5 text-surface-500" %}{% set widgetBorder = "" %} + {% elif widget.type == "webmentions" %} + {% set widgetIcon = "share" %}{% set widgetIconClass = "w-5 h-5 text-surface-500" %}{% set widgetBorder = "" %} + {% elif widget.type == "toc" %} + {% set widgetIcon = "list" %}{% set widgetIconClass = "w-5 h-5 text-surface-500" %}{% set widgetBorder = "" %} + {% elif widget.type == "share" %} + {% set widgetIcon = "share" %}{% set widgetIconClass = "w-5 h-5 text-surface-500" %}{% set widgetBorder = "" %} + {% else %} + {% set widgetIcon = "" %}{% set widgetIconClass = "" %}{% set widgetBorder = "" %} + {% endif %} + {% set widgetKey = "post-widget-" + widget.type + "-" + loop.index0 %} {% set defaultOpen = "true" if loop.index0 < 3 else "false" %} @@ -36,13 +72,16 @@ class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : {{ defaultOpen }} }" > -