hexo-generator-indexed
Advanced tools
Comparing version 0.0.3 to 0.1.1
'use strict'; | ||
const pagination = require('hexo-pagination'); | ||
const _ = require('lodash'); | ||
@@ -24,21 +25,3 @@ module.exports = function(locals) { | ||
posts.data = posts.data.sort((a, b) => { | ||
if (a.sticky && b.sticky) { | ||
return (a.sticky == b.sticky) ? 0 : (b.sticky - a.sticky); | ||
} | ||
else if (a.sticky && !b.sticky) { | ||
return -1; | ||
} | ||
else if (!a.sticky && b.sticky) { | ||
return 1; | ||
} | ||
else { | ||
if (config.index_generator.order_by == '-date') { | ||
return b.date - a.date; | ||
} | ||
else { | ||
return a.date - b.date; | ||
} | ||
}; | ||
}); | ||
posts.data = _.orderBy(posts.data, post => post.sticky || 0, "desc"); | ||
@@ -45,0 +28,0 @@ const paginationDir = config.pagination_dir || 'page'; |
{ | ||
"name": "hexo-generator-indexed", | ||
"version": "0.0.3", | ||
"version": "0.1.1", | ||
"description": "Index generator for Hexo.", | ||
@@ -44,4 +44,5 @@ "main": "index", | ||
"dependencies": { | ||
"hexo-pagination": "0.1.0" | ||
"hexo-pagination": "0.1.0", | ||
"lodash": "^4.17.4" | ||
} | ||
} |
@@ -40,4 +40,4 @@ # hexo-generator-indexed | ||
在文章的[Front-matter](https://hexo.io/docs/front-matter)中增加一个`sticky`参数用来置顶,数字越大,则越靠前。 | ||
Add a `sticky` parameter to the the post's [Front-matter] (https://hexo.io/docs/front-matter) to make the post pinned at the top of home page. | ||
在文章的[Front-matter](https://hexo.io/docs/front-matter)中增加一个`sticky`参数用来置顶,其值应为大于0的整数,表示置顶的优先级(未指定则默认为0)。数字越大,文章越靠前。 | ||
Add a `sticky` parameter to the the post's [Front-matter](https://hexo.io/docs/front-matter) to make the post pinned at the top of home page. | ||
@@ -44,0 +44,0 @@ ```markdown |
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
0
5897
2
7
39
+ Addedlodash@^4.17.4
+ Addedlodash@4.17.21(transitive)