mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
🐛 Fixed custom_excerpt
not being used in RSS feeds (#9219)
closes #9210 * use `custom_excerpt` before `meta_description` in rss
This commit is contained in:
parent
d507eab3e8
commit
341948966d
2 changed files with 26 additions and 1 deletions
|
@ -91,7 +91,7 @@ generateFeed = function generateFeed(data) {
|
|||
htmlContent = processUrls(post.html, data.siteUrl, itemUrl),
|
||||
item = {
|
||||
title: post.title,
|
||||
description: post.meta_description || downsize(htmlContent.html(), {words: 50}),
|
||||
description: post.custom_excerpt || post.meta_description || downsize(htmlContent.html(), {words: 50}),
|
||||
guid: post.id,
|
||||
url: itemUrl,
|
||||
date: post.published_at,
|
||||
|
|
|
@ -209,6 +209,31 @@ describe('RSS', function () {
|
|||
rss(req, res, failTest(done));
|
||||
});
|
||||
|
||||
it('should use excerpt when no meta_description is set', function (done) {
|
||||
rss.__set__('getData', function () {
|
||||
return Promise.resolve({
|
||||
title: 'Test Title',
|
||||
description: 'Testing Desc',
|
||||
permalinks: '/:slug/',
|
||||
results: {posts: [posts[0]], meta: {pagination: {pages: 1}}}
|
||||
});
|
||||
});
|
||||
|
||||
res.send = function send(xmlData) {
|
||||
should.exist(xmlData);
|
||||
|
||||
// special/optional tags
|
||||
xmlData.should.match(/<title><!\[CDATA\[HTML Ipsum\]\]>/);
|
||||
xmlData.should.match(/<description><!\[CDATA\[This is my custom excerpt!/);
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
res.locals.channel = channelUtils.getTestChannel('index');
|
||||
res.locals.channel.isRSS = true;
|
||||
rss(req, res, failTest(done));
|
||||
});
|
||||
|
||||
it('should process urls correctly', function (done) {
|
||||
rss.__set__('getData', function () {
|
||||
return Promise.resolve({
|
||||
|
|
Loading…
Add table
Reference in a new issue