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.
This commit is contained in:
Felix Rieseberg 2015-02-09 10:22:53 -08:00
parent a110b3741f
commit 762a47b6bf

View File

@ -510,6 +510,11 @@ frontendControllers = {
},
htmlContent = cheerio.load(post.html, {decodeEntities: false});
if (post.image) {
htmlContent('p').first().before('<img src="' + post.image + '" />');
htmlContent('img').attr('alt', post.title);
}
// convert relative resource urls to absolute
['href', 'src'].forEach(function (attributeName) {
htmlContent('[' + attributeName + ']').each(function (ix, el) {