Restore Recent Posts as first sidebar widget

This commit is contained in:
svemagie
2026-03-08 07:31:16 +01:00
parent 8439887320
commit 54733a06d8
8 changed files with 64 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
{% if homepageConfig and homepageConfig.blogPostSidebar and homepageConfig.blogPostSidebar.length %}
{# === Data-driven mode: render configured widgets === #}
{% for widget in homepageConfig.blogPostSidebar %}
{% if widget.type == "recent-posts" or widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{# Hidden sidebar widgets by request #}
{% else %}
@@ -169,6 +169,20 @@
{# === Fallback: default blog post sidebar (backward compatibility) === #}
{# Each widget wrapped in collapsible container #}
{# Recent Posts #}
{% set widgetKey = "post-fb-recent-posts" %}
<div class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : true }">
<div class="bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 shadow-sm overflow-hidden">
<button class="widget-header w-full p-4" @click="open = !open; localStorage.setItem('{{ widgetKey }}', open)" :aria-expanded="open ? 'true' : 'false'">
<h3 class="widget-title font-bold text-lg flex items-center gap-2">{{ icon("list", "w-5 h-5 text-surface-600 dark:text-surface-400") }} Recent Posts</h3>
<svg class="widget-chevron" :class="open && 'rotate-180'" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-100" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" x-cloak>
{% include "components/widgets/recent-posts-blog.njk" %}
</div>
</div>
</div>
{# Author Card Compact #}
{% set widgetKey = "post-fb-author-card-compact" %}
<div class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : true }">

View File

@@ -1,7 +1,7 @@
{# CV Page Builder Sidebar — renders widgets from cvPageConfig.sidebar #}
{% if cvPageConfig.sidebar and cvPageConfig.sidebar.length %}
{% for widget in cvPageConfig.sidebar %}
{% if widget.type == "recent-posts" or widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{# Hidden sidebar widgets by request #}
{% elif widget.type == "author-card" %}
{% include "components/widgets/author-card.njk" %}

View File

@@ -4,7 +4,7 @@
{% if homepageConfig.sidebar and homepageConfig.sidebar.length %}
{% for widget in homepageConfig.sidebar %}
{% if widget.type == "recent-posts" or widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{# Hidden sidebar widgets by request #}
{% else %}

View File

@@ -6,7 +6,7 @@
{% if homepageConfig and homepageConfig.blogListingSidebar and homepageConfig.blogListingSidebar.length %}
{# === Data-driven mode: render configured widgets === #}
{% for widget in homepageConfig.blogListingSidebar %}
{% if widget.type == "recent-posts" or widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{# Hidden sidebar widgets by request #}
{% else %}
@@ -158,6 +158,20 @@
{# === Fallback: current hardcoded sidebar (backward compatibility) === #}
{# Each widget wrapped in collapsible container #}
{# Recent Posts #}
{% set widgetKey = "listing-fb-recent-posts" %}
<div class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : true }">
<div class="bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 shadow-sm overflow-hidden">
<button class="widget-header w-full p-4" @click="open = !open; localStorage.setItem('{{ widgetKey }}', open)" :aria-expanded="open ? 'true' : 'false'">
<h3 class="widget-title font-bold text-lg flex items-center gap-2">{{ icon("list", "w-5 h-5 text-surface-600 dark:text-surface-400") }} Recent Posts</h3>
<svg class="widget-chevron" :class="open && 'rotate-180'" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-100" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" x-cloak>
{% include "components/widgets/recent-posts.njk" %}
</div>
</div>
</div>
{# Author Card (h-card) — always shown #}
{% set widgetKey = "listing-fb-author-card" %}
<div class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : true }">

View File

@@ -6,7 +6,7 @@
{% if homepageConfig and homepageConfig.blogPostSidebar and homepageConfig.blogPostSidebar.length %}
{# === Data-driven mode: render configured widgets === #}
{% for widget in homepageConfig.blogPostSidebar %}
{% if widget.type == "recent-posts" or widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{# Hidden sidebar widgets by request #}
{% else %}
@@ -163,6 +163,20 @@
{# === Fallback: default blog post sidebar (backward compatibility) === #}
{# Each widget wrapped in collapsible container #}
{# Recent Posts #}
{% set widgetKey = "post-fb-recent-posts" %}
<div class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : true }">
<div class="bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 shadow-sm overflow-hidden">
<button class="widget-header w-full p-4" @click="open = !open; localStorage.setItem('{{ widgetKey }}', open)" :aria-expanded="open ? 'true' : 'false'">
<h3 class="widget-title font-bold text-lg flex items-center gap-2">{{ icon("list", "w-5 h-5 text-surface-500") }} Recent Posts</h3>
<svg class="widget-chevron" :class="open && 'rotate-180'" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-100" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" x-cloak>
{% include "components/widgets/recent-posts-blog.njk" %}
</div>
</div>
</div>
{# Author Card Compact #}
{% set widgetKey = "post-fb-author-card-compact" %}
<div class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : true }">

View File

@@ -1,7 +1,7 @@
{# CV Page Builder Sidebar — renders widgets from cvPageConfig.sidebar #}
{% if cvPageConfig.sidebar and cvPageConfig.sidebar.length %}
{% for widget in cvPageConfig.sidebar %}
{% if widget.type == "recent-posts" or widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{# Hidden sidebar widgets by request #}
{% elif widget.type == "author-card" %}
{% include "components/widgets/author-card.njk" %}

View File

@@ -4,7 +4,7 @@
{% if homepageConfig.sidebar and homepageConfig.sidebar.length %}
{% for widget in homepageConfig.sidebar %}
{% if widget.type == "recent-posts" or widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{# Hidden sidebar widgets by request #}
{% else %}

View File

@@ -6,7 +6,7 @@
{% if homepageConfig and homepageConfig.blogListingSidebar and homepageConfig.blogListingSidebar.length %}
{# === Data-driven mode: render configured widgets === #}
{% for widget in homepageConfig.blogListingSidebar %}
{% if widget.type == "recent-posts" or widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
{# Hidden sidebar widgets by request #}
{% else %}
@@ -152,6 +152,20 @@
{# === Fallback: current hardcoded sidebar (backward compatibility) === #}
{# Each widget wrapped in collapsible container #}
{# Recent Posts #}
{% set widgetKey = "listing-fb-recent-posts" %}
<div class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : true }">
<div class="bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 shadow-sm overflow-hidden">
<button class="widget-header w-full p-4" @click="open = !open; localStorage.setItem('{{ widgetKey }}', open)" :aria-expanded="open ? 'true' : 'false'">
<h3 class="widget-title font-bold text-lg flex items-center gap-2">{{ icon("list", "w-5 h-5 text-surface-500") }} Recent Posts</h3>
<svg class="widget-chevron" :class="open && 'rotate-180'" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-100" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" x-cloak>
{% include "components/widgets/recent-posts.njk" %}
</div>
</div>
</div>
{# Author Card (h-card) — always shown #}
{% set widgetKey = "listing-fb-author-card" %}
<div class="widget-collapsible mb-4" x-data="{ open: localStorage.getItem('{{ widgetKey }}') !== null ? localStorage.getItem('{{ widgetKey }}') === 'true' : true }">