From 91ed859a3509f8d794c7f8161ee93064611f7558 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Tue, 24 Feb 2026 16:58:46 +0100 Subject: [PATCH] feat: harmonize blog views with homepage UI/UX Add color-coded left borders to post cards on all blog listing and category pages, and make sidebar widgets collapsible with localStorage persistence on both listing and single-post sidebars. --- _includes/components/blog-sidebar.njk | 292 ++++++++++++++++++++------ _includes/components/sidebar.njk | 281 +++++++++++++++++++------ articles.njk | 2 +- blog.njk | 16 +- bookmarks.njk | 2 +- categories.njk | 20 +- likes.njk | 2 +- notes.njk | 2 +- photos.njk | 2 +- replies.njk | 2 +- reposts.njk | 2 +- 11 files changed, 486 insertions(+), 137 deletions(-) diff --git a/_includes/components/blog-sidebar.njk b/_includes/components/blog-sidebar.njk index 0cbfb38..c108cdb 100644 --- a/_includes/components/blog-sidebar.njk +++ b/_includes/components/blog-sidebar.njk @@ -1,75 +1,239 @@ {# 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 #} {% if homepageConfig and homepageConfig.blogPostSidebar and homepageConfig.blogPostSidebar.length %} {# === Data-driven mode: render configured widgets === #} {% for widget in homepageConfig.blogPostSidebar %} - {% if widget.type == "author-card-compact" %} - {% include "components/widgets/author-card-compact.njk" %} - {% elif widget.type == "author-card" %} - {% include "components/widgets/author-card.njk" %} - {% elif widget.type == "toc" %} - {% include "components/widgets/toc.njk" %} - {% elif widget.type == "post-categories" %} - {% include "components/widgets/post-categories.njk" %} - {% elif widget.type == "recent-posts" %} - {% include "components/widgets/recent-posts-blog.njk" %} - {% elif widget.type == "webmentions" %} - {% include "components/widgets/webmentions.njk" %} - {% elif widget.type == "share" %} - {% include "components/widgets/share.njk" %} - {% elif widget.type == "subscribe" %} - {% include "components/widgets/subscribe.njk" %} - {% elif widget.type == "social-activity" %} - {% include "components/widgets/social-activity.njk" %} - {% elif widget.type == "github-repos" %} - {% include "components/widgets/github-repos.njk" %} - {% elif widget.type == "funkwhale" %} - {% include "components/widgets/funkwhale.njk" %} - {% elif widget.type == "blogroll" %} - {% include "components/widgets/blogroll.njk" %} - {% elif widget.type == "feedland" %} - {% include "components/widgets/feedland.njk" %} - {% elif widget.type == "categories" %} - {% include "components/widgets/categories.njk" %} - {% elif widget.type == "recent-comments" %} - {% include "components/widgets/recent-comments.njk" %} - {% elif widget.type == "search" %} - -
-

Search

- - -
-
- {% elif widget.type == "fediverse-follow" %} - {% include "components/widgets/fediverse-follow.njk" %} - {% elif widget.type == "custom-html" %} - {% set wConfig = widget.config or {} %} - -
- {% if wConfig.title %} -

{{ wConfig.title }}

- {% endif %} - {% if wConfig.content %} -
- {{ wConfig.content | safe }} -
- {% endif %} -
-
- {% else %} - + + {# Resolve widget title #} + {% if widget.type == "search" %}{% set widgetTitle = "Search" %} + {% elif widget.type == "social-activity" %}{% set widgetTitle = "Social Activity" %} + {% elif widget.type == "github-repos" %}{% set widgetTitle = "GitHub" %} + {% elif widget.type == "funkwhale" %}{% set widgetTitle = "Listening" %} + {% elif widget.type == "recent-posts" %}{% set widgetTitle = "Recent Posts" %} + {% elif widget.type == "blogroll" %}{% set widgetTitle = "Blogroll" %} + {% elif widget.type == "feedland" %}{% set widgetTitle = "FeedLand" %} + {% elif widget.type == "categories" %}{% set widgetTitle = "Categories" %} + {% elif widget.type == "webmentions" %}{% set widgetTitle = "Webmentions" %} + {% elif widget.type == "recent-comments" %}{% set widgetTitle = "Recent Comments" %} + {% elif widget.type == "fediverse-follow" %}{% set widgetTitle = "Fediverse" %} + {% elif widget.type == "author-card" %}{% set widgetTitle = "Author" %} + {% elif widget.type == "author-card-compact" %}{% set widgetTitle = "Author" %} + {% elif widget.type == "subscribe" %}{% set widgetTitle = "Subscribe" %} + {% elif widget.type == "toc" %}{% set widgetTitle = "Table of Contents" %} + {% elif widget.type == "post-categories" %}{% set widgetTitle = "Categories" %} + {% elif widget.type == "share" %}{% set widgetTitle = "Share" %} + {% elif widget.type == "custom-html" %}{% set widgetTitle = (widget.config.title if widget.config and widget.config.title) or "Custom" %} + {% else %}{% set widgetTitle = widget.type %} {% endif %} + + {% set widgetKey = "post-widget-" + widget.type + "-" + loop.index0 %} + {% set defaultOpen = "true" if loop.index0 < 3 else "false" %} + + {# Collapsible wrapper — Alpine.js handles toggle, localStorage persists state #} +
+
+ + +
+ {# Widget content — inner .widget provides padding, inner title hidden by CSS #} + {% if widget.type == "author-card-compact" %} + {% include "components/widgets/author-card-compact.njk" %} + {% elif widget.type == "author-card" %} + {% include "components/widgets/author-card.njk" %} + {% elif widget.type == "toc" %} + {% include "components/widgets/toc.njk" %} + {% elif widget.type == "post-categories" %} + {% include "components/widgets/post-categories.njk" %} + {% elif widget.type == "recent-posts" %} + {% include "components/widgets/recent-posts-blog.njk" %} + {% elif widget.type == "webmentions" %} + {% include "components/widgets/webmentions.njk" %} + {% elif widget.type == "share" %} + {% include "components/widgets/share.njk" %} + {% elif widget.type == "subscribe" %} + {% include "components/widgets/subscribe.njk" %} + {% elif widget.type == "social-activity" %} + {% include "components/widgets/social-activity.njk" %} + {% elif widget.type == "github-repos" %} + {% include "components/widgets/github-repos.njk" %} + {% elif widget.type == "funkwhale" %} + {% include "components/widgets/funkwhale.njk" %} + {% elif widget.type == "blogroll" %} + {% include "components/widgets/blogroll.njk" %} + {% elif widget.type == "feedland" %} + {% include "components/widgets/feedland.njk" %} + {% elif widget.type == "categories" %} + {% include "components/widgets/categories.njk" %} + {% elif widget.type == "recent-comments" %} + {% include "components/widgets/recent-comments.njk" %} + {% elif widget.type == "search" %} + +
+ + +
+
+ {% elif widget.type == "fediverse-follow" %} + {% include "components/widgets/fediverse-follow.njk" %} + {% elif widget.type == "custom-html" %} + {% set wConfig = widget.config or {} %} + +
+ {% if wConfig.content %} +
+ {{ wConfig.content | safe }} +
+ {% endif %} +
+
+ {% else %} + + {% endif %} +
+
+
+ {% endfor %} {% else %} {# === Fallback: default blog post sidebar (backward compatibility) === #} - {% include "components/widgets/author-card-compact.njk" %} - {% include "components/widgets/toc.njk" %} - {% include "components/widgets/post-categories.njk" %} - {% include "components/widgets/recent-posts-blog.njk" %} - {% include "components/widgets/webmentions.njk" %} - {% include "components/widgets/share.njk" %} - {% include "components/widgets/subscribe.njk" %} - {% include "components/widgets/recent-comments.njk" %} + {# Each widget wrapped in collapsible container #} + + {# Author Card Compact #} + {% set widgetKey = "post-fb-author-card-compact" %} +
+
+ +
+ {% include "components/widgets/author-card-compact.njk" %} +
+
+
+ + {# Table of Contents #} + {% set widgetKey = "post-fb-toc" %} +
+
+ +
+ {% include "components/widgets/toc.njk" %} +
+
+
+ + {# Post Categories #} + {% set widgetKey = "post-fb-post-categories" %} +
+
+ +
+ {% include "components/widgets/post-categories.njk" %} +
+
+
+ + {# Recent Posts #} + {% set widgetKey = "post-fb-recent-posts" %} +
+
+ +
+ {% include "components/widgets/recent-posts-blog.njk" %} +
+
+
+ + {# Webmentions #} + {% set widgetKey = "post-fb-webmentions" %} +
+
+ +
+ {% include "components/widgets/webmentions.njk" %} +
+
+
+ + {# Share #} + {% set widgetKey = "post-fb-share" %} +
+
+ +
+ {% include "components/widgets/share.njk" %} +
+
+
+ + {# Subscribe #} + {% set widgetKey = "post-fb-subscribe" %} +
+
+ +
+ {% include "components/widgets/subscribe.njk" %} +
+
+
+ + {# Recent Comments #} + {% set widgetKey = "post-fb-recent-comments" %} +
+
+ +
+ {% include "components/widgets/recent-comments.njk" %} +
+
+
{% endif %} diff --git a/_includes/components/sidebar.njk b/_includes/components/sidebar.njk index 3301fb0..3395a0a 100644 --- a/_includes/components/sidebar.njk +++ b/_includes/components/sidebar.njk @@ -1,93 +1,250 @@ {# Sidebar — for blog listing pages (/blog/, /notes/, /articles/...) #} {# Data-driven when homepageConfig.blogListingSidebar is configured, otherwise falls back to default widgets #} +{# Each widget is wrapped in a collapsible container with localStorage persistence #} {% if homepageConfig and homepageConfig.blogListingSidebar and homepageConfig.blogListingSidebar.length %} {# === Data-driven mode: render configured widgets === #} {% for widget in homepageConfig.blogListingSidebar %} - {% if widget.type == "author-card" %} - {% include "components/widgets/author-card.njk" %} - {% elif widget.type == "author-card-compact" %} - {% include "components/widgets/author-card-compact.njk" %} - {% elif widget.type == "social-activity" %} - {% include "components/widgets/social-activity.njk" %} - {% elif widget.type == "github-repos" %} - {% include "components/widgets/github-repos.njk" %} - {% elif widget.type == "funkwhale" %} - {% include "components/widgets/funkwhale.njk" %} - {% elif widget.type == "recent-posts" %} - {% include "components/widgets/recent-posts.njk" %} - {% elif widget.type == "blogroll" %} - {% if blogrollStatus and blogrollStatus.source == "indiekit" %} - {% include "components/widgets/blogroll.njk" %} - {% endif %} - {% elif widget.type == "feedland" %} - {% include "components/widgets/feedland.njk" %} - {% elif widget.type == "categories" %} - {% include "components/widgets/categories.njk" %} - {% elif widget.type == "subscribe" %} - {% include "components/widgets/subscribe.njk" %} - {% elif widget.type == "recent-comments" %} - {% include "components/widgets/recent-comments.njk" %} - {% elif widget.type == "search" %} - -
-

Search

- - -
-
- {% elif widget.type == "webmentions" %} - {% include "components/widgets/webmentions.njk" %} - {% elif widget.type == "fediverse-follow" %} - {% include "components/widgets/fediverse-follow.njk" %} - {% elif widget.type == "custom-html" %} - {% set wConfig = widget.config or {} %} - -
- {% if wConfig.title %} -

{{ wConfig.title }}

- {% endif %} - {% if wConfig.content %} -
- {{ wConfig.content | safe }} -
- {% endif %} -
-
- {% else %} - + + {# Resolve widget title #} + {% if widget.type == "search" %}{% set widgetTitle = "Search" %} + {% elif widget.type == "social-activity" %}{% set widgetTitle = "Social Activity" %} + {% elif widget.type == "github-repos" %}{% set widgetTitle = "GitHub" %} + {% elif widget.type == "funkwhale" %}{% set widgetTitle = "Listening" %} + {% elif widget.type == "recent-posts" %}{% set widgetTitle = "Recent Posts" %} + {% elif widget.type == "blogroll" %}{% set widgetTitle = "Blogroll" %} + {% elif widget.type == "feedland" %}{% set widgetTitle = "FeedLand" %} + {% elif widget.type == "categories" %}{% set widgetTitle = "Categories" %} + {% elif widget.type == "webmentions" %}{% set widgetTitle = "Webmentions" %} + {% elif widget.type == "recent-comments" %}{% set widgetTitle = "Recent Comments" %} + {% elif widget.type == "fediverse-follow" %}{% set widgetTitle = "Fediverse" %} + {% elif widget.type == "author-card" %}{% set widgetTitle = "Author" %} + {% elif widget.type == "author-card-compact" %}{% set widgetTitle = "Author" %} + {% elif widget.type == "subscribe" %}{% set widgetTitle = "Subscribe" %} + {% elif widget.type == "custom-html" %}{% set widgetTitle = (widget.config.title if widget.config and widget.config.title) or "Custom" %} + {% else %}{% set widgetTitle = widget.type %} {% endif %} + + {% set widgetKey = "listing-widget-" + widget.type + "-" + loop.index0 %} + {% set defaultOpen = "true" if loop.index0 < 3 else "false" %} + + {# Collapsible wrapper — Alpine.js handles toggle, localStorage persists state #} +
+
+ + +
+ {# Widget content — inner .widget provides padding, inner title hidden by CSS #} + {% if widget.type == "author-card" %} + {% include "components/widgets/author-card.njk" %} + {% elif widget.type == "author-card-compact" %} + {% include "components/widgets/author-card-compact.njk" %} + {% elif widget.type == "social-activity" %} + {% include "components/widgets/social-activity.njk" %} + {% elif widget.type == "github-repos" %} + {% include "components/widgets/github-repos.njk" %} + {% elif widget.type == "funkwhale" %} + {% include "components/widgets/funkwhale.njk" %} + {% elif widget.type == "recent-posts" %} + {% include "components/widgets/recent-posts.njk" %} + {% elif widget.type == "blogroll" %} + {% if blogrollStatus and blogrollStatus.source == "indiekit" %} + {% include "components/widgets/blogroll.njk" %} + {% endif %} + {% elif widget.type == "feedland" %} + {% include "components/widgets/feedland.njk" %} + {% elif widget.type == "categories" %} + {% include "components/widgets/categories.njk" %} + {% elif widget.type == "subscribe" %} + {% include "components/widgets/subscribe.njk" %} + {% elif widget.type == "recent-comments" %} + {% include "components/widgets/recent-comments.njk" %} + {% elif widget.type == "search" %} + +
+ + +
+
+ {% elif widget.type == "webmentions" %} + {% include "components/widgets/webmentions.njk" %} + {% elif widget.type == "fediverse-follow" %} + {% include "components/widgets/fediverse-follow.njk" %} + {% elif widget.type == "custom-html" %} + {% set wConfig = widget.config or {} %} + +
+ {% if wConfig.content %} +
+ {{ wConfig.content | safe }} +
+ {% endif %} +
+
+ {% else %} + + {% endif %} +
+
+
+ {% endfor %} {% else %} {# === Fallback: current hardcoded sidebar (backward compatibility) === #} + {# Each widget wrapped in collapsible container #} + {# Author Card (h-card) — always shown #} - {% include "components/widgets/author-card.njk" %} + {% set widgetKey = "listing-fb-author-card" %} +
+
+ +
+ {% include "components/widgets/author-card.njk" %} +
+
+
{# Social Activity — Bluesky/Mastodon feeds #} - {% include "components/widgets/social-activity.njk" %} + {% set widgetKey = "listing-fb-social-activity" %} +
+
+ +
+ {% include "components/widgets/social-activity.njk" %} +
+
+
{# GitHub Repos #} - {% include "components/widgets/github-repos.njk" %} + {% set widgetKey = "listing-fb-github-repos" %} +
+
+ +
+ {% include "components/widgets/github-repos.njk" %} +
+
+
{# Funkwhale — Now Playing / Listening Stats #} - {% include "components/widgets/funkwhale.njk" %} + {% set widgetKey = "listing-fb-funkwhale" %} +
+
+ +
+ {% include "components/widgets/funkwhale.njk" %} +
+
+
- {# Recent Posts (for non-blog pages) #} - {% include "components/widgets/recent-posts.njk" %} + {# Recent Posts #} + {% set widgetKey = "listing-fb-recent-posts" %} +
+
+ +
+ {% include "components/widgets/recent-posts.njk" %} +
+
+
{# Blogroll — only when backend is available #} {% if blogrollStatus and blogrollStatus.source == "indiekit" %} - {% include "components/widgets/blogroll.njk" %} + {% set widgetKey = "listing-fb-blogroll" %} +
+
+ +
+ {% include "components/widgets/blogroll.njk" %} +
+
+
{% endif %} {# FeedLand — only when backend is available #} {% if blogrollStatus and blogrollStatus.source == "indiekit" %} - {% include "components/widgets/feedland.njk" %} + {% set widgetKey = "listing-fb-feedland" %} +
+
+ +
+ {% include "components/widgets/feedland.njk" %} +
+
+
{% endif %} {# Recent Comments #} - {% include "components/widgets/recent-comments.njk" %} + {% set widgetKey = "listing-fb-recent-comments" %} +
+
+ +
+ {% include "components/widgets/recent-comments.njk" %} +
+
+
{# Categories/Tags #} - {% include "components/widgets/categories.njk" %} + {% set widgetKey = "listing-fb-categories" %} +
+
+ +
+ {% include "components/widgets/categories.njk" %} +
+
+
{% endif %} diff --git a/articles.njk b/articles.njk index 56e9ba9..de448b0 100644 --- a/articles.njk +++ b/articles.njk @@ -25,7 +25,7 @@ permalink: "articles/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNu {% if paginatedArticles.length > 0 %}