hexo-pagination
Pagination utilities for Hexo generator plugins.
Last updated a year ago by tomap .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hexo-pagination 
SYNC missed versions from official npm registry.

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])

Option Description Default
perPage Posts displayed per page 10
format URL format page/%d/
layout Layout. This value can be a string or an array. ['archive', 'index']
data Extra 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.

Data Description
base Base URL
total Total pages
current Current page number
current_url Path of the current page (which equals to path)
posts The slice of posts for the current page
prev Previous page number
prev_link The path to the previous page
next Next page number
next_link The path to the next page

License

MIT

Current Tags

  • 1.0.0                                ...           latest (a year ago)
  • 1.0.0-rc1                                ...           next (a year ago)

5 Versions

  • 1.0.0                                ...           a year ago
  • 1.0.0-rc1                                ...           a year ago
  • 0.1.0                                ...           4 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Downloads
Today 60
This Week 351
This Month 6,087
Last Day 291
Last Week 1,930
Last Month 5,968
Dependencies (0)
None
Dev Dependencies (5)

Copyright 2014 - 2016 © taobao.org |