hexo-generator-indexed
Advanced tools
Comparing version 1.1.0 to 1.2.0
'use strict'; | ||
const pagination = require('hexo-pagination'); | ||
const { sort } = require('timsort'); | ||
@@ -24,3 +25,3 @@ module.exports = function(locals) { | ||
posts.data.sort((x, y) => (y.sticky || 0) - (x.sticky || 0)); | ||
sort(posts.data, (a, b) => (b.sticky || 0) - (a.sticky || 0)); | ||
@@ -27,0 +28,0 @@ const paginationDir = config.pagination_dir || 'page'; |
{ | ||
"name": "hexo-generator-indexed", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Index generator for Hexo.", | ||
@@ -43,8 +43,9 @@ "main": "index", | ||
"hexo": "4.2.0", | ||
"mocha": "7.1.1", | ||
"mocha": "7.1.2", | ||
"nyc": "15.0.1" | ||
}, | ||
"dependencies": { | ||
"hexo-pagination": "1.0.0" | ||
"hexo-pagination": "1.0.0", | ||
"timsort": "^0.3.0" | ||
} | ||
} |
@@ -31,3 +31,3 @@ # hexo-generator-indexed | ||
- **path**: Root path for your blog's index page. | ||
- **path**: Root path for your blog's index page. | ||
- default: "" | ||
@@ -37,3 +37,3 @@ - **per_page**: Posts displayed per page. | ||
- `0` disables pagination | ||
- **order_by**: Posts order. | ||
- **order_by**: Posts order. | ||
- default: date descending | ||
@@ -52,3 +52,3 @@ - **pagination_dir**: URL format. | ||
在文章的[Front-matter](https://hexo.io/docs/front-matter)中增加一个`sticky`参数用来置顶,其值应为大于0的整数,表示置顶的优先级(未指定则默认为0)。数字越大,文章越靠前。 | ||
在文章的 [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. | ||
@@ -63,7 +63,7 @@ | ||
采用`sticky`关键词是因为这个在[NexT主题](https://github.com/hexo-next/hexo-theme-next)中已经定义了置顶样式,因此可以直接拿来使用。 | ||
采用 `sticky` 关键词是因为这个在 [NexT 主题](https://github.com/hexo-next/hexo-theme-next)中已经定义了置顶样式,因此可以直接拿来使用。 | ||
### 隐藏文章 Hide article | ||
在文章的Front-matter中增加一个`hide`参数用来隐藏。 | ||
在文章的 Front-matter 中增加一个 `hide` 参数用来隐藏。 | ||
Add a `hide` parameter to the the post's Front-matter to hide the post from home page. | ||
@@ -80,3 +80,3 @@ | ||
在Hexo的`_config.yml`中可以通过`hide_categories`选项设置隐藏某个分类下的文章,例如: | ||
在 Hexo 的 `_config.yml` 中可以通过 `hide_categories` 选项设置隐藏某个分类下的文章,例如: | ||
You can hide articles in specified categories by setting `hide_categories` in hexo `_config.yml`, e.g. | ||
@@ -99,3 +99,3 @@ | ||
[size-image]: https://img.shields.io/github/languages/code-size/stevenjoezhang/hexo-generator-indexed?style=flat-square | ||
[size-image]: https://img.shields.io/github/languages/code-size/hexo-next/hexo-generator-indexed?style=flat-square | ||
[dm-image]: https://img.shields.io/npm/dm/hexo-generator-indexed?style=flat-square | ||
@@ -102,0 +102,0 @@ [dt-image]: https://img.shields.io/npm/dt/hexo-generator-indexed?style=flat-square |
6517
39
2
+ Addedtimsort@^0.3.0
+ Addedtimsort@0.3.0(transitive)