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 %}