From 06c66ceef31f7cd487a51ee6dd11d04d2edb2643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Val=C3=A9rio?= Date: Sat, 30 Dec 2023 19:27:05 +0000 Subject: [PATCH] small fix for the generated description --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2bee077..a00da99 100644 --- a/index.js +++ b/index.js @@ -174,7 +174,7 @@ function createFeed(items) { return feed } /** - * Generete the HTML page with the aggregated contents + * Generate the HTML page with the aggregated contents * @param {*} items * @returns */ @@ -184,7 +184,8 @@ function createHTML(items, sources) { let dateFormatter = new Intl.DateTimeFormat('pt-PT', { timeZone: 'UTC' }) for (let item of items) { - item.description = striptags(item.content).substring(0, 250) + '[...]' + let shortdescription = striptags(item.content).substring(0, 250) + item.description = shortdescription ? shortdescription + ' [...]' : "" item.formattedDate = item.pubDate ? dateFormatter.format(new Date(item.pubDate)) : ''