From 78688c8f6321b6e1d6c775379652f5833e743dbf Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 14 Jun 2022 15:52:06 -0500 Subject: [PATCH 1/4] Include media namespace in RSS feeds --- services/rss/src/routes/all-published-content.js | 2 +- services/rss/src/routes/website-scheduled-content.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/rss/src/routes/all-published-content.js b/services/rss/src/routes/all-published-content.js index 6790d7273..7a0c5a476 100644 --- a/services/rss/src/routes/all-published-content.js +++ b/services/rss/src/routes/all-published-content.js @@ -30,7 +30,7 @@ module.exports = asyncRoute(async (req, res) => { const { edges } = data.allPublishedContent; const parts = [ - '', + '', createChannel({ title: channel.title || `Published Content Feed | ${website.name}`, link: channel.link || website.origin, diff --git a/services/rss/src/routes/website-scheduled-content.js b/services/rss/src/routes/website-scheduled-content.js index 17722157a..6bc0ae7d2 100644 --- a/services/rss/src/routes/website-scheduled-content.js +++ b/services/rss/src/routes/website-scheduled-content.js @@ -47,7 +47,7 @@ module.exports = asyncRoute(async (req, res) => { const { section, edges } = data.websiteScheduledContent; const parts = [ - '', + '', createChannel({ title: channel.title || `${section.fullName || section.name} | ${website.name}`, link: channel.link || `${website.origin}${section.canonicalPath}`, From ba90793ee0f95e80f097cde183af6350e36292db Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 14 Jun 2022 15:52:27 -0500 Subject: [PATCH 2/4] Properly parse media items and items as a whole --- services/rss/src/utils/create-item.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/rss/src/utils/create-item.js b/services/rss/src/utils/create-item.js index 9c65e2ded..c42ea16c1 100644 --- a/services/rss/src/utils/create-item.js +++ b/services/rss/src/utils/create-item.js @@ -42,10 +42,13 @@ module.exports = ({ } const imageMediaTags = getAsArray(images, 'edges').reduce((arr, { node }) => { const { src } = node; - if (src) arr.push(``); + if (src) { + const srcUrl = new URL(src); + arr.push(``); + } return arr; }, []); if (imageMediaTags.length) parts.push(...imageMediaTags); if (embedSrc) parts.push(``); - return `${parts.join('')}`; + return `${parts.join('\n')}`; }; From 487d19a3904376273d5527227fa3c2ebe96f6701 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 14 Jun 2022 15:52:51 -0500 Subject: [PATCH 3/4] Properly join "parts" of RSS feed. --- services/rss/src/routes/website-scheduled-content.js | 2 +- services/rss/src/utils/create-channel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/rss/src/routes/website-scheduled-content.js b/services/rss/src/routes/website-scheduled-content.js index 6bc0ae7d2..fa82afd99 100644 --- a/services/rss/src/routes/website-scheduled-content.js +++ b/services/rss/src/routes/website-scheduled-content.js @@ -58,5 +58,5 @@ module.exports = asyncRoute(async (req, res) => { }), '', ]; - res.end(parts.join('')); + res.end(parts.join('\n')); }); diff --git a/services/rss/src/utils/create-channel.js b/services/rss/src/utils/create-channel.js index 56c3a28d2..b3aea72ab 100644 --- a/services/rss/src/utils/create-channel.js +++ b/services/rss/src/utils/create-channel.js @@ -17,5 +17,5 @@ module.exports = ({ `${xml.encode(description)}`, ]; if (language) parts.push(`${language}`); - return `${parts.join('')}${items.join('')}`; + return `${parts.join('\n')}${items.join('\n')}`; }; From 1c6b6717ecb4d888db4b65e6771f301871071a09 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Mon, 20 Jun 2022 09:52:18 -0500 Subject: [PATCH 4/4] Re-parse query string replace &'s with &'s --- services/rss/src/utils/create-item.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/rss/src/utils/create-item.js b/services/rss/src/utils/create-item.js index c42ea16c1..d57cbc5f8 100644 --- a/services/rss/src/utils/create-item.js +++ b/services/rss/src/utils/create-item.js @@ -43,8 +43,7 @@ module.exports = ({ const imageMediaTags = getAsArray(images, 'edges').reduce((arr, { node }) => { const { src } = node; if (src) { - const srcUrl = new URL(src); - arr.push(``); + arr.push(``); } return arr; }, []);