diff --git a/lib/plugins/generator/paginator.js b/lib/plugins/generator/paginator.js index 80e97eed36..0aa9a2251f 100644 --- a/lib/plugins/generator/paginator.js +++ b/lib/plugins/generator/paginator.js @@ -12,8 +12,15 @@ var Paginator = function(base, posts, num, total){ this.total = total; this.current = num; this.current_url = format(base, num); + + this.reverse_order = config.reverse_order; + if (this.reverse_order) { + posts = posts.reverse(); + } + this.posts = posts.slice(perPage * (num - 1), perPage * num); + if (num == 1){ this.prev = 0; this.prev_link = ''; @@ -49,4 +56,4 @@ module.exports = function(base, posts, layout, render, options){ } else { render(base, [layout, 'archive', 'index'], _.extend({posts: posts}, options)); } -}; \ No newline at end of file +};