From 0a52b12f02340c5b51f3290235fbb0255dd8ec08 Mon Sep 17 00:00:00 2001 From: Tobias O Date: Wed, 29 Oct 2025 19:59:45 +1300 Subject: [PATCH] fix: handle line-clamp issue with news --- static/js/discourse-api.js | 6 +++--- templates/index/index.html | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/static/js/discourse-api.js b/static/js/discourse-api.js index 6abae296..469b73c5 100644 --- a/static/js/discourse-api.js +++ b/static/js/discourse-api.js @@ -63,17 +63,17 @@ class DiscourseAPI { * @returns {string} Cleaned excerpt */ extractExcerpt(excerpt) { - if (!excerpt) return 'Click to read more...'; + if (!excerpt) return 'Click to read more'; - // Remove HTML tags and clean up + // Remove HTML tags and clean up; collapse whitespace; do not add manual ellipsis return excerpt .replace(/<[^>]*>/g, '') // Remove HTML tags .replace(/ /g, ' ') // Replace   with spaces .replace(/&/g, '&') // Replace & with & .replace(/</g, '<') // Replace < with < .replace(/>/g, '>') // Replace > with > + .replace(/\s+/g, ' ') // Collapse all whitespace/newlines .trim() - .substring(0, 200) + '...'; // Limit length } /** diff --git a/templates/index/index.html b/templates/index/index.html index 7995fadb..d0784d5b 100644 --- a/templates/index/index.html +++ b/templates/index/index.html @@ -192,7 +192,9 @@ ${topic.title} -

${topic.excerpt}

+
+ ${topic.excerpt} +