Skip to content

Commit

Permalink
Allow the root path for the blogs index page to be configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Randy Findley committed Mar 29, 2017
1 parent e184833 commit 3e02137
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ $ npm install hexo-generator-index --save

``` yaml
index_generator:
path: ''
per_page: 10
order_by: -date
```
- **path**: Root path for your blogs index page. (default = '')
- **per_page**: Posts displayed per page. (0 = disable pagination)
- **order_by**: Posts order. (Order by date descending by default)
Expand Down
3 changes: 2 additions & 1 deletion lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ module.exports = function(locals) {
var config = this.config;
var posts = locals.posts.sort(config.index_generator.order_by);
var paginationDir = config.pagination_dir || 'page';
var path = config.index_generator.path || '';

return pagination('', posts, {
return pagination(path, posts, {
perPage: config.index_generator.per_page,
layout: ['index', 'archive'],
format: paginationDir + '/%d/',
Expand Down

0 comments on commit 3e02137

Please sign in to comment.