Skip to content

Commit

Permalink
Fix category path when placed on root
Browse files Browse the repository at this point in the history
This patch fixes the double slashes (http://site.com//cat1) in the category path, when you configure `category_dir` with '/' or ''
  • Loading branch information
giuseppelt authored and leesei committed Feb 20, 2016
1 parent dd7478f commit 3d926ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/models/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ module.exports = function(ctx) {

Category.virtual('path').get(function() {
var catDir = ctx.config.category_dir;
if (catDir[catDir.length - 1] !== '/') catDir += '/';
if (catDir === '/') catDir = '';
if (catDir.length && catDir[catDir.length - 1] !== '/') catDir += '/';

return catDir + this.slug + '/';
});
Expand Down

0 comments on commit 3d926ec

Please sign in to comment.