diff --git a/static/js/discourse-api.js b/static/js/discourse-api.js index 469b73c5..f1b65020 100644 --- a/static/js/discourse-api.js +++ b/static/js/discourse-api.js @@ -63,17 +63,20 @@ class DiscourseAPI { * @returns {string} Cleaned excerpt */ extractExcerpt(excerpt) { - if (!excerpt) return 'Click to read more'; + if (!excerpt) return 'No preview available yet'; // Remove HTML tags and clean up; collapse whitespace; do not add manual ellipsis - return excerpt + const cleaned = 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() + .trim(); + + // Check if excerpt is empty after cleaning + return cleaned || 'No preview available yet'; } /** diff --git a/templates/index/index.html b/templates/index/index.html index dec6ea8e..1bf16f7d 100644 --- a/templates/index/index.html +++ b/templates/index/index.html @@ -305,16 +305,13 @@ const date = new Date(topic.created_at).toLocaleDateString(); return ` -
-
-

+
+
+

${topic.title}

-
- ${topic.excerpt} -