0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Change RSS content type & use absolute URL in meta

no issue

- changes the content type for the RSS feeds from text/xml to
  application/rss+xml
- changes the link rel=alternate tag to use an absolute URL for the feed
  in the blog meta data
This commit is contained in:
Hannah Wolfe 2014-11-24 22:33:49 +00:00
parent 7126c10a04
commit 31ae0c6923
4 changed files with 16 additions and 15 deletions

View file

@ -545,7 +545,7 @@ frontendControllers = {
feed.item(item);
});
}).then(function () {
res.set('Content-Type', 'text/xml; charset=UTF-8');
res.set('Content-Type', 'application/rss+xml; charset=UTF-8');
res.send(feed.xml());
});
});

View file

@ -156,7 +156,7 @@ ghost_head = function (options) {
head.push('<meta name="generator" content="Ghost ' + trimmedVersion + '" />');
head.push('<link rel="alternate" type="application/rss+xml" title="' +
title + '" href="' + config.urlFor('rss') + '" />');
title + '" href="' + config.urlFor('rss', null, true) + '" />');
return filters.doFilter('ghost_head', head);
}).then(function (head) {
var headString = _.reduce(head, function (memo, item) { return memo + '\n ' + item; }, '');

View file

@ -376,7 +376,7 @@ describe('Frontend Routing', function () {
it('should respond with xml', function (done) {
request.get('/rss/')
.expect('Content-Type', 'text/xml; charset=utf-8')
.expect('Content-Type', 'application/rss+xml; charset=utf-8')
.expect('Cache-Control', testUtils.cacheRules['public'])
.expect(200)
.end(function (err, res) {
@ -751,7 +751,7 @@ describe('Frontend Routing', function () {
it('should serve RSS with date permalink', function (done) {
request.get('/rss/')
.expect('Content-Type', 'text/xml; charset=utf-8')
.expect('Content-Type', 'application/rss+xml; charset=utf-8')
.expect('Cache-Control', testUtils.cacheRules['public'])
.expect(200)
.end(function (err, res) {

View file

@ -33,7 +33,7 @@ describe('{{ghost_head}} helper', function () {
should.exist(rendered);
rendered.string.should.equal('<link rel="canonical" href="http://testurl.com/" />\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
@ -44,7 +44,7 @@ describe('{{ghost_head}} helper', function () {
should.exist(rendered);
rendered.string.should.equal('<link rel="canonical" href="http://testurl.com/" />\n' +
' <meta name="generator" content="Ghost 0.9" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
@ -96,7 +96,7 @@ describe('{{ghost_head}} helper', function () {
' "image": "http://testurl.com/content/images/test-image.png",\n "keywords": "tag1, tag2, tag3",\n' +
' "description": "blog description..."\n}\n </script>\n\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
@ -149,7 +149,7 @@ describe('{{ghost_head}} helper', function () {
' "image": "http://testurl.com/content/images/test-image.png",\n "keywords": "tag1, tag2, tag3",\n' +
' "description": "blog &quot;test&quot; description..."\n}\n </script>\n\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
@ -198,7 +198,7 @@ describe('{{ghost_head}} helper', function () {
' "image": "http://testurl.com/content/images/test-image.png",\n' +
' "description": "blog description..."\n}\n </script>\n\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
@ -246,7 +246,7 @@ describe('{{ghost_head}} helper', function () {
' "datePublished": "' + post.published_at + '",\n "dateModified": "' + post.updated_at + '",\n' +
' "keywords": "tag1, tag2, tag3",\n "description": "blog description..."\n}\n </script>\n\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
@ -279,7 +279,7 @@ describe('{{ghost_head}} helper', function () {
should.exist(rendered);
rendered.string.should.equal('<link rel="canonical" href="http://testurl.com/post/" />\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
@ -290,7 +290,7 @@ describe('{{ghost_head}} helper', function () {
should.exist(rendered);
rendered.string.should.equal('<link rel="canonical" href="http://testurl.com/about/" />\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
@ -303,7 +303,7 @@ describe('{{ghost_head}} helper', function () {
' <link rel="prev" href="http://testurl.com/page/2/" />\n' +
' <link rel="next" href="http://testurl.com/page/4/" />\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
});
@ -315,7 +315,7 @@ describe('{{ghost_head}} helper', function () {
' <link rel="prev" href="http://testurl.com/" />\n' +
' <link rel="next" href="http://testurl.com/page/3/" />\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="http://testurl.com/rss/" />');
done();
}).catch(done);
});
@ -339,7 +339,8 @@ describe('{{ghost_head}} helper', function () {
should.exist(rendered);
rendered.string.should.equal('<link rel="canonical" href="http://testurl.com/blog/" />\n' +
' <meta name="generator" content="Ghost 0.3" />\n' +
' <link rel="alternate" type="application/rss+xml" title="Ghost" href="/blog/rss/" />');
' <link rel="alternate" type="application/rss+xml" title="Ghost" ' +
'href="http://testurl.com/blog/rss/" />');
done();
}).catch(done);