From d81bca6e399675e7fb405a089dd2a0dcf4682a33 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 7 Jun 2022 14:31:16 +0100 Subject: [PATCH] fix crash in parser due to kieran's feed --- src/index.11tydata.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.11tydata.js b/src/index.11tydata.js index 6fc2fc7..a8574ca 100644 --- a/src/index.11tydata.js +++ b/src/index.11tydata.js @@ -42,6 +42,8 @@ async function do_feeds() { }) .map((feed) => { feed.data = feed.data.value; + if(typeof process.env["DEBUG_FEEDS"] != "undefined") + console.log("FEED", feed.data); return feed; }); global.feed_authors_error = feed_data.filter(el => el.data.isRejected) @@ -61,11 +63,13 @@ async function do_feeds() { if(typeof item.content == "object") { if(item.content.type === "html" && typeof item.content.text === "string") item.content = item.content.text; + else if(typeof item.summary === "string") + item.content = item.summary; } if(!item.description || (typeof item.description == "string" && item.description.length === 0)) item.description = striptags(item.content) - .substr(0, DESCRIPTION_LENGTH); + .substring(0, DESCRIPTION_LENGTH); if(!item.pubdate) item.pubdate = item.published || item.updated