File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ module.exports = function(locals) {
8
8
9
9
posts . data . sort ( ( a , b ) => ( b . sticky || 0 ) - ( a . sticky || 0 ) ) ;
10
10
11
- const paginationDir = config . pagination_dir || 'page' ;
11
+ const paginationDir = config . index_generator . pagination_dir || config . pagination_dir || 'page' ;
12
12
const path = config . index_generator . path || '' ;
13
13
14
14
return pagination ( path , posts , {
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ describe('Index generator', () => {
127
127
} ) ;
128
128
} ) ;
129
129
130
- it ( 'custom pagination_dir' , ( ) => {
130
+ it ( 'custom pagination_dir - global setting ' , ( ) => {
131
131
hexo . config . index_generator . per_page = 1 ;
132
132
hexo . config . pagination_dir = 'yo' ;
133
133
@@ -141,4 +141,20 @@ describe('Index generator', () => {
141
141
hexo . config . index_generator . per_page = 10 ;
142
142
hexo . config . pagination_dir = 'page' ;
143
143
} ) ;
144
+
145
+ it ( 'custom pagination_dir - plugin setting' , ( ) => {
146
+ hexo . config . index_generator . per_page = 1 ;
147
+ hexo . config . index_generator . pagination_dir = 'yoyo' ;
148
+
149
+ const result = generator ( locals ) ;
150
+
151
+ result [ 0 ] . path . should . eql ( '' ) ;
152
+ result [ 1 ] . path . should . eql ( 'yoyo/2/' ) ;
153
+ result [ 2 ] . path . should . eql ( 'yoyo/3/' ) ;
154
+
155
+ // Restore config
156
+ hexo . config . index_generator . per_page = 10 ;
157
+ hexo . config . index_generator . pagination_dir = 'page' ;
158
+ } ) ;
159
+
144
160
} ) ;
You can’t perform that action at this time.
0 commit comments