feat: data-driven blog sidebars and fix recentPosts glob

Fix recentPosts collection glob (content/posts/ → content/) so the
widget actually finds posts. Extract blog-sidebar widgets into reusable
partials. Make both sidebar.njk (listing pages) and blog-sidebar.njk
(post pages) configurable via homepageConfig.blogListingSidebar and
homepageConfig.blogPostSidebar, with fallback to current hardcoded
widgets for backward compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ricardo
2026-02-13 00:13:25 +01:00
parent a54d094891
commit cf3586eadd
11 changed files with 420 additions and 303 deletions

View File

@@ -0,0 +1,17 @@
{# Table of Contents Widget (for articles with headings) #}
{% if toc and toc.length %}
<div class="widget">
<h3 class="widget-title">Contents</h3>
<nav class="toc">
<ul class="space-y-1 text-sm">
{% for item in toc %}
<li class="{% if item.level > 2 %}ml-{{ (item.level - 2) * 3 }}{% endif %}">
<a href="#{{ item.slug }}" class="text-surface-600 dark:text-surface-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors">
{{ item.text }}
</a>
</li>
{% endfor %}
</ul>
</nav>
</div>
{% endif %}