Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielr18/ghost-pagination
Custom Handlebars Helper to improve how you paginate in Ghost
https://github.com/danielr18/ghost-pagination
Last synced: about 1 month ago
JSON representation
Custom Handlebars Helper to improve how you paginate in Ghost
- Host: GitHub
- URL: https://github.com/danielr18/ghost-pagination
- Owner: danielr18
- License: mit
- Created: 2016-03-05T04:19:56.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-05T07:55:55.000Z (almost 9 years ago)
- Last Synced: 2024-12-15T08:29:11.368Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 4
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ghost - Handlebars Pagination Helper
Custom Handlebars Helper to improve Pagination in Ghost. Based on [Handlebars Paginate](https://github.com/olalonde/handlebars-paginate).![preview](https://github.com/danielr18/ghost-pagination/raw/master/preview.jpg)
##Install
```
npm install ghost-pagination
```
##Usage
Ghost config.js
```javascript
/* ... */
var pagination = require('ghost-pagination');
var hbs = require('express-hbs');
/* ... */
hbs.registerHelper('paginate', pagination);
/* ... */
```partials/pagination.hbs
```html
{{#paginate page pages limit="5"}}
{{#if first}}
- {{n}}
{{#if ellipsis}}
- more_horiz
{{/if}}
{{/if}}
{{#if middle}}
- {{n}}
{{/if}}
{{#if last}}
{{#if ellipsis}}
- more_horiz
{{/if}}
- {{n}}
{{/if}}
{{/paginate}}
```Include limit attribute if you wish to restrict the number of pages, that appear between the first one and last one.
You can easily include previous and next links with Ghost built-in Pagination attributes. Refer to [Handlebars Template Example](examples/pagination.hbs).
## License
MIT License