mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
feat: add comment system components and recent comments widget
- Comment area on post pages (IndieAuth sign-in, submit, display) - Alpine.js client-side component for auth flow and comment CRUD - Recent comments sidebar widget with build-time data fetching - Include comments.js in base layout, comments.njk before webmentions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
25
_includes/components/widgets/recent-comments.njk
Normal file
25
_includes/components/widgets/recent-comments.njk
Normal file
@@ -0,0 +1,25 @@
|
||||
{# Recent Comments Widget — sidebar #}
|
||||
{% if recentComments and recentComments.length %}
|
||||
<div class="sidebar-widget">
|
||||
<h3 class="text-sm font-semibold text-surface-600 dark:text-surface-400 uppercase tracking-wide mb-3">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-surface-500 hover:underline">View post</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user