mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
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:
17
_includes/components/widgets/toc.njk
Normal file
17
_includes/components/widgets/toc.njk
Normal 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 %}
|
||||
Reference in New Issue
Block a user