Files
blog-eleventy-indiekit/_includes/components/widgets/recent-comments.njk
Ricardo 1bf6f9358a feat: wrap all widgets and comments in is-land on:visible
Add <is-land on:visible> lazy-loading wrapper to every widget template
and the comments section for consistent deferred rendering. Widgets
that already had it (social-activity, github-repos, blogroll, feedland,
webmentions) are unchanged. Also wraps inline search and custom-html
widgets in all sidebar container files.
2026-02-22 00:31:01 +01:00

28 lines
1.0 KiB
Plaintext

{# Recent Comments Widget — sidebar #}
{% if recentComments and recentComments.length %}
<is-land on:visible>
<div class="widget">
<h3 class="widget-title">Recent Comments</h3>
<ul class="space-y-3">
{% for comment in recentComments %}
<li class="text-sm">
<div class="flex items-start gap-2">
{% if comment.author and comment.author.photo %}
<img src="{{ comment.author.photo }}" alt="{{ comment.author.name }}"
class="w-6 h-6 rounded-full flex-shrink-0 mt-0.5" loading="lazy">
{% endif %}
<div>
<span class="font-medium">{{ comment.author.name or "Anonymous" }}</span>
<p class="text-surface-600 dark:text-surface-400 line-clamp-2">{{ comment.content.text | truncate(80) }}</p>
{% if comment["comment-target"] %}
<a href="{{ comment['comment-target'] }}" class="text-xs text-primary-600 dark:text-primary-400 hover:underline">View post</a>
{% endif %}
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
</is-land>
{% endif %}