mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
Replicates Dave Winer's blogroll.js visual rendering (240px bordered container, Ubuntu/Rancho fonts, Title/When sort, caret wedges, truncated titles, relative timestamps, "Powered by FeedLand" footer) using Alpine.js and the blogroll API instead of jQuery + external scripts. Registered in all three sidebar types (homepage, blog listing, blog post) and in the fallback sidebar.
67 lines
3.1 KiB
Plaintext
67 lines
3.1 KiB
Plaintext
{# Blog Sidebar - Shown on individual post pages #}
|
|
{# Data-driven when homepageConfig.blogPostSidebar is configured, otherwise falls back to default widgets #}
|
|
|
|
{% 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 == "search" %}
|
|
<div class="sidebar-widget">
|
|
<h3 class="text-sm font-semibold text-surface-600 dark:text-surface-400 uppercase tracking-wide mb-3">Search</h3>
|
|
<div id="blog-sidebar-search"></div>
|
|
<script>initPagefind("#blog-sidebar-search");</script>
|
|
</div>
|
|
{% elif widget.type == "custom-html" %}
|
|
{% set wConfig = widget.config or {} %}
|
|
<div class="sidebar-widget">
|
|
{% if wConfig.title %}
|
|
<h3 class="text-sm font-semibold text-surface-600 dark:text-surface-400 uppercase tracking-wide mb-3">{{ wConfig.title }}</h3>
|
|
{% endif %}
|
|
{% if wConfig.content %}
|
|
<div class="prose dark:prose-invert prose-sm max-w-none">
|
|
{{ wConfig.content | safe }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<!-- Unknown widget type: {{ widget.type }} -->
|
|
{% 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" %}
|
|
{% endif %}
|