Files
indiekit-blog/_includes/components/widgets/webmentions.njk
Ricardo a4c121d203 fix: make post-navigation and webmentions sidebar widgets functional
Post navigation now uses previousInCollection/nextInCollection filters
to find adjacent posts (avoids Nunjucks loop scoping bug). Webmentions
sidebar widget now uses webmentionsForUrl and webmentionsByType filters
instead of non-existent filter function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 08:53:35 +01:00

34 lines
1.5 KiB
Plaintext

{# Webmentions Sidebar Widget (compact counts for this post) #}
{% set _mentions = webmentions | webmentionsForUrl(page.url, urlAliases) %}
{% if _mentions and _mentions.length %}
<div class="widget">
<h3 class="widget-title flex items-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"/>
</svg>
Interactions
</h3>
<div class="space-y-2">
{% set likes = _mentions | webmentionsByType("likes") %}
{% set reposts = _mentions | webmentionsByType("reposts") %}
{% set replies = _mentions | webmentionsByType("replies") %}
{% if likes.length %}
<p class="text-sm text-surface-600 dark:text-surface-400">
<span class="font-medium text-surface-900 dark:text-surface-100">{{ likes.length }}</span> likes
</p>
{% endif %}
{% if reposts.length %}
<p class="text-sm text-surface-600 dark:text-surface-400">
<span class="font-medium text-surface-900 dark:text-surface-100">{{ reposts.length }}</span> reposts
</p>
{% endif %}
{% if replies.length %}
<p class="text-sm text-surface-600 dark:text-surface-400">
<span class="font-medium text-surface-900 dark:text-surface-100">{{ replies.length }}</span> replies
</p>
{% endif %}
</div>
</div>
{% endif %}