diff --git a/front/src/lib/_utils/rss.js b/front/src/lib/_utils/rss.js index ae4b49d73..eaeab06d5 100644 --- a/front/src/lib/_utils/rss.js +++ b/front/src/lib/_utils/rss.js @@ -6,47 +6,55 @@ const feedDescription = 'Thoughts, learnings, and updates from Dan Grebb.'; const feedLink = 'https://www.dgrebb.com'; const feedUpdated = new Date(); -export const xml = (posts) => ` - - ${feedTitle} - - - ${feedLink}/ - ${feedUpdated.toISOString()} - - Dan Grebb - - ${feedDescription} - JavaScript -${posts - .map((post) => { - const { slug, publishedAt, summary } = post.attributes; +export const xml = (posts) => ` + + + ${feedTitle} + + + ${feedLink}/ + ${feedUpdated.toISOString()} + + Dan Grebb + + ${feedDescription} + JavaScript + ${posts + .map((post) => { + const { slug, publishedAt, summary } = post.attributes; - const image = - post?.attributes?.hero?.data?.attributes?.formats?.thumbnail?.url || - false; + const image = + post?.attributes?.hero?.data?.attributes?.formats?.small?.url || + false, + thumbnail = + post?.attributes?.hero?.data?.attributes?.formats?.thumbnail?.url || + false, + imageMIME = post?.attributes?.hero?.data?.attributes?.mime || false, + imageAlt = + post?.attributes?.hero?.data?.attributes.alternativeText || false; - const { altText } = post?.attributes?.hero?.data?.attributes || false; - - return ` - ${post.attributes.title} - - ${website}${path}/${slug}/ - ${new Date(publishedAt).toISOString()} - ${new Date(publishedAt).toISOString()} - ${ - summary ? `` : '' - } - ${ - image - ? ` - ${image} - ${altText} - ${slug} - ` - : '' - } - `; - }) - .join('\n')} - `; + return ` + ${post.attributes.title.replace('&', '&')} + + ${website}${path}/${slug}/ + ${new Date(publishedAt).toISOString()} + ${new Date(publishedAt).toISOString()} + ${ + summary && + ` + + + ${imageAlt} + +

${summary}

+ ]]> +
` + } + ${thumbnail && ``} +
`; + }) + .join('\n')} + + +`;