hexo-generator-tag
Advanced tools
Comparing version 0.2.0 to 1.0.0-rc1
/* global hexo */ | ||
'use strict'; | ||
var assign = require('object-assign'); | ||
hexo.config.tag_generator = assign({ | ||
hexo.config.tag_generator = Object.assign({ | ||
per_page: hexo.config.per_page == null ? 10 : hexo.config.per_page | ||
@@ -8,0 +6,0 @@ }, hexo.config.tag_generator); |
'use strict'; | ||
var pagination = require('hexo-pagination'); | ||
const pagination = require('hexo-pagination'); | ||
module.exports = function(locals) { | ||
var config = this.config; | ||
var perPage = config.tag_generator.per_page; | ||
var paginationDir = config.pagination_dir || 'page'; | ||
var tags = locals.tags; | ||
var tagDir; | ||
const config = this.config; | ||
const perPage = config.tag_generator.per_page; | ||
const paginationDir = config.pagination_dir || 'page'; | ||
const orderBy = config.tag_generator.order_by || '-date'; | ||
const tags = locals.tags; | ||
let tagDir; | ||
var pages = tags.reduce(function(result, tag) { | ||
const pages = tags.reduce((result, tag) => { | ||
if (!tag.length) return result; | ||
var posts = tag.posts.sort('-date'); | ||
var data = pagination(tag.path, posts, { | ||
const posts = tag.posts.sort(orderBy); | ||
const data = pagination(tag.path, posts, { | ||
perPage: perPage, | ||
@@ -18,0 +19,0 @@ layout: ['tag', 'archive', 'index'], |
{ | ||
"name": "hexo-generator-tag", | ||
"version": "0.2.0", | ||
"version": "1.0.0-rc1", | ||
"description": "Tag generator for Hexo.", | ||
@@ -8,5 +8,4 @@ "main": "index", | ||
"eslint": "eslint .", | ||
"jscs": "jscs .", | ||
"test": "mocha test/index.js", | ||
"test-cov": "istanbul cover --print both _mocha -- test/index.js" | ||
"test-cov": "nyc npm run test" | ||
}, | ||
@@ -16,2 +15,6 @@ "directories": { | ||
}, | ||
"files": [ | ||
"index.js", | ||
"lib/" | ||
], | ||
"repository": "hexojs/hexo-generator-tag", | ||
@@ -27,15 +30,15 @@ "homepage": "http://hexo.io/", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"chai": "^4.2.0", | ||
"hexo": "^3.1.1", | ||
"mocha": "^2.4.5", | ||
"istanbul": "^0.4.2", | ||
"eslint": "^1.10.3", | ||
"jscs": "^2.9.0", | ||
"eslint-config-hexo": "^1.0.2", | ||
"jscs-preset-hexo": "^1.0.1" | ||
"mocha": "^6.0.2", | ||
"eslint": "^6.0.1", | ||
"eslint-config-hexo": "^3.0.0", | ||
"nyc": "^14.1.1" | ||
}, | ||
"dependencies": { | ||
"hexo-pagination": "0.0.2", | ||
"object-assign": "^4.0.1" | ||
"hexo-pagination": "1.0.0-rc1" | ||
}, | ||
"engines": { | ||
"node": ">=8.6.0" | ||
} | ||
} |
# hexo-generator-tag | ||
[![Build Status](https://travis-ci.org/hexojs/hexo-generator-tag.svg?branch=master)](https://travis-ci.org/hexojs/hexo-generator-tag) [![NPM version](https://badge.fury.io/js/hexo-generator-tag.svg)](http://badge.fury.io/js/hexo-generator-tag) [![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-generator-tag.svg)](https://coveralls.io/r/hexojs/hexo-generator-tag?branch=master) | ||
[![Build Status](https://travis-ci.org/hexojs/hexo-generator-tag.svg?branch=master)](https://travis-ci.org/hexojs/hexo-generator-tag) | ||
[![NPM version](https://badge.fury.io/js/hexo-generator-tag.svg)](https://www.npmjs.com/package/hexo-generator-tag) | ||
[![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-generator-tag.svg)](https://coveralls.io/r/hexojs/hexo-generator-tag?branch=master) | ||
@@ -18,5 +20,7 @@ Tag generator for [Hexo]. | ||
per_page: 10 | ||
order_by: -date | ||
``` | ||
- **per_page**: Posts displayed per page. (0 = disable pagination) | ||
- **order_by**: Posts order. (Order by date descending by default) | ||
@@ -27,2 +31,2 @@ ## License | ||
[Hexo]: http://hexo.io/ | ||
[Hexo]: http://hexo.io/ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
6
31
4348
5
1
+ Addedhexo-pagination@1.0.0-rc1(transitive)
- Removedobject-assign@^4.0.1
- Removedhexo-pagination@0.0.2(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedutils-merge@1.0.1(transitive)
Updatedhexo-pagination@1.0.0-rc1