diff --git a/_includes/components/blog-sidebar.njk b/_includes/components/blog-sidebar.njk index 54bde2e..fc73460 100644 --- a/_includes/components/blog-sidebar.njk +++ b/_includes/components/blog-sidebar.njk @@ -3,8 +3,12 @@ {# Each widget is wrapped in a collapsible container with localStorage persistence #} {% from "components/icon.njk" import icon %} +{% set isArticlePost = (postType == "article") or (page.url and page.url.startsWith('/articles/') and page.url != '/articles/') %} +{% set showArticleToc = isArticlePost %} + {% if homepageConfig and homepageConfig.blogPostSidebar and homepageConfig.blogPostSidebar.length %} {# === Data-driven mode: render configured widgets === #} + {% set hasConfiguredToc = '"toc"' in (homepageConfig.blogPostSidebar | dump) %} {% for widget in homepageConfig.blogPostSidebar %} {# Resolve widget title #} @@ -160,6 +164,21 @@ + {% if showArticleToc and not hasConfiguredToc and (widget.type == "author-card" or widget.type == "author-card-compact") %} + {% set widgetKey = "post-widget-toc-article" %} +
+ {% endif %} + {% endfor %} {% else %} {# === Fallback: aligned with rmendes.net article sidebar === #} @@ -178,6 +197,22 @@ + {% if showArticleToc %} + {# Table of Contents (articles only) #} + {% set widgetKey = "post-widget-toc-article" %} + + {% endif %} + {# Share #} {% set widgetKey = "post-widget-share-1" %} + {% if showArticleToc and not hasConfiguredToc and (widget.type == "author-card" or widget.type == "author-card-compact") %} + {% set widgetKey = "post-widget-toc-article" %} + + {% endif %} + {% endfor %} {% else %} {# === Fallback: aligned with rmendes.net article sidebar === #} @@ -178,6 +197,22 @@ + {% if showArticleToc %} + {# Table of Contents (articles only) #} + {% set widgetKey = "post-widget-toc-article" %} + + {% endif %} + {# Share #} {% set widgetKey = "post-widget-share-1" %}