Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hexo-generator-indexed

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-generator-indexed - npm Package Compare versions

Comparing version 0.0.3 to 0.1.1

21

lib/generator.js
'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';

5

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc