From 59cbe7c238366dee660c5c3ec4f37da549566921 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Fri, 6 Feb 2026 22:56:03 +0100 Subject: [PATCH] feat: add bookmark to timeline, mark-read to item view - Add bookmark button to item-card.njk (timeline view) - Add mark-read button to item.njk (full item view) - Add JavaScript handler for mark-read on item page - Pass channel info to item template for mark-read API call Co-Authored-By: Claude Opus 4.5 --- lib/controllers/reader.js | 8 ++++++ package.json | 2 +- views/item.njk | 55 ++++++++++++++++++++++++++++++++++++ views/partials/item-card.njk | 4 +++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/lib/controllers/reader.js b/lib/controllers/reader.js index 9fcf4d0..3751768 100644 --- a/lib/controllers/reader.js +++ b/lib/controllers/reader.js @@ -314,9 +314,17 @@ export async function item(request, response) { return response.status(404).render("404"); } + // Get the channel for this item (needed for mark-read) + let channel = null; + if (itemDocument.channelId) { + const channelsCollection = application.collections.get("microsub_channels"); + channel = await channelsCollection.findOne({ _id: itemDocument.channelId }); + } + response.render("item", { title: itemDocument.name || "Item", item: itemDocument, + channel, baseUrl: request.baseUrl, }); } diff --git a/package.json b/package.json index 24131b3..e92e396 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-microsub", - "version": "1.0.18", + "version": "1.0.19", "description": "Microsub endpoint for Indiekit. Enables subscribing to feeds and reading content using the Microsub protocol.", "keywords": [ "indiekit", diff --git a/views/item.njk b/views/item.njk index 0d738b6..6f4de2b 100644 --- a/views/item.njk +++ b/views/item.njk @@ -146,6 +146,61 @@ {{ icon("bookmark") }} {{ __("microsub.item.bookmark") }} + {% if not item._is_read %} + + {% endif %} + + {% endblock %} diff --git a/views/partials/item-card.njk b/views/partials/item-card.njk index 54e97b7..23f7173 100644 --- a/views/partials/item-card.njk +++ b/views/partials/item-card.njk @@ -165,6 +165,10 @@ {{ icon("repost") }} Repost + + {{ icon("bookmark") }} + Bookmark + {% if not item._is_read %}