Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/plugins/filter/post_permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function postPermalinkFilter(data) {
year: data.date.format('YYYY'),
month: data.date.format('MM'),
day: data.date.format('DD'),
hour: data.date.format('HH'),
minute: data.date.format('mm'),
i_month: data.date.format('M'),
i_day: data.date.format('D')
};
Expand Down
15 changes: 15 additions & 0 deletions test/scripts/filters/post_permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,19 @@ describe('post_permalink', () => {
return Post.removeById(post._id);
});
});

it('post_title', () => {
hexo.config.permalink = ':year/:month/:day/:hour/:minute/:post_title/';

return Post.insert({
source: 'sub/2015-05-06-my-new-post.md',
slug: '2015-05-06-my-new-post',
title: 'My New Post',
date: moment('2015-05-06 12:13')
}).then(post => {
postPermalink(post).should.eql('2015/05/06/12/13/my-new-post/');
hexo.config.permalink = PERMALINK;
return Post.removeById(post._id);
});
});
});