Skip to content

Commit

Permalink
Merge pull request #1572 from vhf/feed-tag-fix
Browse files Browse the repository at this point in the history
Fix HTML issue with RSS/Atom feeds: rel="alternate"
  • Loading branch information
漩涡 committed Oct 30, 2015
2 parents cd0d987 + 3e4a7da commit f7b204d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/helper/feed_tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function feedTagHelper(path, options) {
var title = options.title || this.config.title;
var type = options.type || 'atom';

return '<link rel="alternative" href="' + this.url_for(path) + '" title="' + title + '" type="application/' + type + '+xml">';
return '<link rel="alternate" href="' + this.url_for(path) + '" title="' + title + '" type="application/' + type + '+xml">';
}

module.exports = feedTagHelper;
6 changes: 3 additions & 3 deletions test/scripts/helpers/feed_tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ describe('feed_tag', function() {
var feed = require('../../../lib/plugins/helper/feed_tag').bind(ctx);

it('path', function() {
feed('atom.xml').should.eql('<link rel="alternative" href="/atom.xml" title="Hexo" type="application/atom+xml">');
feed('atom.xml').should.eql('<link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">');
});

it('title', function() {
feed('atom.xml', {title: 'RSS Feed'}).should.eql('<link rel="alternative" href="/atom.xml" title="RSS Feed" type="application/atom+xml">');
feed('atom.xml', {title: 'RSS Feed'}).should.eql('<link rel="alternate" href="/atom.xml" title="RSS Feed" type="application/atom+xml">');
});

it('type', function() {
feed('rss.xml', {type: 'rss'}).should.eql('<link rel="alternative" href="/rss.xml" title="Hexo" type="application/rss+xml">');
feed('rss.xml', {type: 'rss'}).should.eql('<link rel="alternate" href="/rss.xml" title="Hexo" type="application/rss+xml">');
});
});

0 comments on commit f7b204d

Please sign in to comment.