hexo-pagination

    2.0.0 • Public • Published

    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

    Install

    npm i hexo-pagination

    Homepage

    hexo.io/

    DownloadsWeekly Downloads

    15,437

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    4.94 kB

    Total Files

    4

    Last publish

    Collaborators

    • ertrzyiks
    • abnerchou
    • tommy351
    • hexobot
    • jlhwung
    • tomap
    • curben
    • yoshinorin