1.0.0 • Published 3 years ago

hexo-pagination-tilden v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

hexo-pagination

Build Status NPM version Coverage Status

Pagination utilities for Hexo generator plugins.

Installation

$ npm install hexo-pagination --save

Usage

pagination(base, posts, options)

OptionDescriptionDefault
perPagePosts displayed per page10
formatURL formatpage/%d/
layoutLayout. This value can be a string or an array.'archive', 'index'
dataExtra data

For example:

var pagination = require('hexo-pagination');

pagination('/tags/hexo', [], {
  perPage: 10,
  format: 'page/%d/',
  layout: ['archive', 'index'],
  data: {
    tag: 'hexo'
  }
});

This function returns an array containing objects with 3 properties: path, layout, data.

DataDescription
baseBase URL
totalTotal pages
currentCurrent page number
current_urlPath of the current page (which equals to path)
postsThe slice of posts for the current page
prevPrevious page number
prev_linkThe path to the previous page
nextNext page number
next_linkThe path to the next page

License

MIT