0.0.2 • Published 8 years ago
xecio-pagination v0.0.2
xecio-pagination
Pagination utilities for Xecio generator plugins.
Installation
$ npm install xecio-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('xecio-pagination');
pagination('/tags/xecio', [], {
perPage: 10,
format: 'page/%d/',
layout: ['archive', 'index'],
data: {
tag: 'xecio'
}
});
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
0.0.2
8 years ago