From 762a47b6bffee5caa80137ddbba19d19f694f026 Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Mon, 9 Feb 2015 10:22:53 -0800 Subject: [PATCH] Add Post Image to RSS Feed Closes #4888 - If a post cover image exists, it is added to the `description` tag (at the very front). This allows RSS readers to pic up the picture. --- core/server/controllers/frontend.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/server/controllers/frontend.js b/core/server/controllers/frontend.js index 0ca6ac78fd..54f9a61bf8 100644 --- a/core/server/controllers/frontend.js +++ b/core/server/controllers/frontend.js @@ -510,6 +510,11 @@ frontendControllers = { }, htmlContent = cheerio.load(post.html, {decodeEntities: false}); + if (post.image) { + htmlContent('p').first().before(''); + htmlContent('img').attr('alt', post.title); + } + // convert relative resource urls to absolute ['href', 'src'].forEach(function (attributeName) { htmlContent('[' + attributeName + ']').each(function (ix, el) {