Files
blog-eleventy-indiekit/_includes/components/blog-sidebar.njk
Ricardo 2c172566c8 feat: add fediverse follow me sidebar widget
Reuses the existing fediverseInteract Alpine.js component to let
visitors follow the site author from their own fediverse instance.
Registered in all three sidebar routers (homepage, blog listing,
blog post) as widget type "fediverse-follow".
2026-02-23 16:50:27 +01:00

76 lines
3.3 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 == "recent-comments" %}
{% include "components/widgets/recent-comments.njk" %}
{% elif widget.type == "search" %}
<is-land on:visible>
<div class="widget">
<h3 class="widget-title">Search</h3>
<div id="blog-sidebar-search"></div>
<script>initPagefind("#blog-sidebar-search");</script>
</div>
</is-land>
{% elif widget.type == "fediverse-follow" %}
{% include "components/widgets/fediverse-follow.njk" %}
{% elif widget.type == "custom-html" %}
{% set wConfig = widget.config or {} %}
<is-land on:visible>
<div class="widget">
{% if wConfig.title %}
<h3 class="widget-title">{{ wConfig.title }}</h3>
{% endif %}
{% if wConfig.content %}
<div class="prose dark:prose-invert prose-sm max-w-none">
{{ wConfig.content | safe }}
</div>
{% endif %}
</div>
</is-land>
{% 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" %}
{% include "components/widgets/recent-comments.njk" %}
{% endif %}