File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
example/docs/views/category2 Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 55 - tag3
66categories :
77 - category2
8- sticky : true
8+ sticky : 1
99---
1010
1111first page in category2
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ categories:
77 - category2
88keys :
99 - ' 1232'
10+ sticky : 2
1011---
1112
1213second page in category2
Original file line number Diff line number Diff line change @@ -18,8 +18,16 @@ export default {
1818 ? ! ( home == true || title == undefined || date === undefined || publish === false )
1919 : ! ( home == true || title == undefined || publish === false )
2020 } )
21+ this . _sortstickyArr ( stickyArr )
2122 return stickyArr . concat ( posts )
2223 } ,
24+ _sortstickyArr ( posts ) {
25+ if ( posts . length > 0 ) {
26+ posts . sort ( ( a , b ) => {
27+ return b . sticky - a . sticky
28+ } )
29+ }
30+ } ,
2331 _sortPostData ( posts ) {
2432 posts . sort ( ( a , b ) => {
2533 return this . _getTimeNum ( b ) - this . _getTimeNum ( a )
You can’t perform that action at this time.
0 commit comments