Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Pagination helper for Handlebars.
JavaScript
branch: master

v0.0.3

latest commit c0a52461fc
@olalonde authored

README.md

Handlerbars Paginate helper

screenshot

Install

npm install handlebars-paginate

Usage

hbs.js

/* ... */

var paginate = require('handlebars-paginate');

Handlebars.registerHelper('paginate', paginate);

/* ... */

var html = template({pagination: {
  page: 3,
  pageCount: 10
}});

template.hbs

<div class="pagination pagination-centered">
  <ul>
    {{#paginate pagination type="previous"}}
      <li {{#if disabled}}class="disabled"{{/if}}><a href="?p={{n}}" >Prev</a></li>
    {{/paginate}}
    {{#paginate pagination type="middle" limit="7"}}
      <li {{#if active}}class="active"{{/if}}><a href="?p={{n}}">{{n}}</a></li>
    {{/paginate}}
    {{#paginate pagination type="next"}}
      <li {{#if disabled}}class="disabled"{{/if}}><a href="?p={{n}}">Next</a></li>
    {{/paginate}}
  </ul>
</div>

License

MIT License

Something went wrong with that request. Please try again.