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:
rmdes
2026-02-21 21:56:15 +01:00
parent c1e9983c66
commit fa7bfb26ea
7 changed files with 293 additions and 0 deletions

24
_data/recentComments.js Normal file
View File

@@ -0,0 +1,24 @@
/**
* Recent Comments Data
* Fetches the 5 most recent comments at build time for the sidebar widget.
*/
import EleventyFetch from "@11ty/eleventy-fetch";
const INDIEKIT_URL = process.env.SITE_URL || "https://example.com";
export default async function () {
try {
const url = `${INDIEKIT_URL}/comments/api/comments?limit=5`;
console.log(`[recentComments] Fetching: ${url}`);
const data = await EleventyFetch(url, {
duration: "15m",
type: "json",
});
console.log(`[recentComments] Got ${(data.children || []).length} comments`);
return data.children || [];
} catch (error) {
console.log(`[recentComments] Unavailable: ${error.message}`);
return [];
}
}