From bd704da19ef11d8fbae9375235395c7ed6c859aa Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 30 Apr 2023 12:08:03 +0100 Subject: [PATCH] fix(daily-email): RSS feed tags --- src/pages/rss/daily.xml.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/pages/rss/daily.xml.js b/src/pages/rss/daily.xml.js index ab65b708..5b77f2ba 100644 --- a/src/pages/rss/daily.xml.js +++ b/src/pages/rss/daily.xml.js @@ -22,6 +22,17 @@ export async function get() { ]); }; + const convertTag = (tag) => { + const words = tag.split("-"); + const wordCount = words.length; + + if (wordCount > 1) { + return _.upperFirst(_.camelCase(tag)); + } + + return _.lowerCase(tag); + } + return rss({ title: 'Daily email list', description: 'A daily newsletter on software development, DevOps, community, and open-source.', @@ -37,10 +48,10 @@ export async function get() { `, link: `${import.meta.env.SITE}/${email.data.permalink}`, pubDate: email.data.pubDate, - title: `${email.data.title}`, + title: `${email.data.title.trim()}`, customData: ` - ${email.data.tags.map(tag => `#${tag}`).join('')} + ${email.data.tags.map(tag => `#${convertTag(tag)}`).join(' ')} `, })) });