Skip to content

Commit

Permalink
Merge 982e008 into 6ab45ce
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaasler committed Aug 30, 2015
2 parents 6ab45ce + 982e008 commit 6391d0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
13 changes: 2 additions & 11 deletions lib/generator.js
Expand Up @@ -25,17 +25,8 @@ module.exports = function(locals) {
var posts = locals.posts.sort('-date');
if (feedConfig.limit) posts = posts.limit(feedConfig.limit);

var url;

// Sorry for that, it is hexo URL handling way.
if (config.root === '/') {
url = config.url + config.root;
} else {
url = config.url + '/';
}

// And sorry for that too.
url = url.replace(/([^:])\/\//g, '$1/');
var url = config.url;
if (url[url.length - 1] !== '/') url += '/';

var xml = template.render({
config: config,
Expand Down
6 changes: 3 additions & 3 deletions test/index.js
Expand Up @@ -115,9 +115,9 @@ describe('Feed generator', function() {
path: 'atom.xml'
};

var checkURL = function(root, path, valid) {
hexo.config.url = root;
hexo.config.path = path;
var checkURL = function(url, root, valid) {
hexo.config.url = url;
hexo.config.root = root;

var result = generator(locals);
var $ = cheerio.load(result.data);
Expand Down

0 comments on commit 6391d0e

Please sign in to comment.