File tree 2 files changed +16
-2
lines changed
2 files changed +16
-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 @@ -123,7 +123,7 @@ describe('Index generator', () => {
123
123
} ) ;
124
124
} ) ;
125
125
126
- it ( 'custom pagination_dir' , ( ) => {
126
+ it ( 'custom pagination_dir - global setting ' , ( ) => {
127
127
hexo . config . index_generator . per_page = 1 ;
128
128
hexo . config . pagination_dir = 'yo' ;
129
129
@@ -135,4 +135,18 @@ describe('Index generator', () => {
135
135
136
136
} ) ;
137
137
138
+ it ( 'custom pagination_dir - plugin setting' , ( ) => {
139
+ hexo . config . index_generator . per_page = 1 ;
140
+ hexo . config . index_generator . pagination_dir = 'yoyo' ;
141
+
142
+ const result = generator ( locals ) ;
143
+
144
+ result [ 0 ] . path . should . eql ( '' ) ;
145
+ result [ 1 ] . path . should . eql ( 'yoyo/2/' ) ;
146
+ result [ 2 ] . path . should . eql ( 'yoyo/3/' ) ;
147
+
148
+ // Restore config
149
+ hexo . config . index_generator . per_page = 10 ;
150
+ hexo . config . index_generator . pagination_dir = 'page' ;
151
+ } ) ;
138
152
} ) ;
You can’t perform that action at this time.
0 commit comments