ghost-need-pagination
v0.1.3
Published
Custom handlebars helper to show ghost pagination if only it's needed
Downloads
13
Maintainers
Readme
Ghost-Need-Pagination
Custom handlebars helper to display pagination if only it's needed, in other words, if only it's more than one page.
Installation
npm install ghost-need-pagination
Example
Register custom helper in the config.js
ghost file:
var need_pagination = require('ghost-need-pagination');
var hbs = require('express-hbs');
hbs.registerHelper('need-pagination', need_pagination);
Update ghost template partials/pagination.hbs
:
{{#need_pagination pages}}
<nav class="pagination" role="navigation">
{{#if prev}}
<a href="{{page_url prev}}">
<i class="fa fa-chevron-left" aria-hidden="true"></i>
</a>
{{/if}}
{{#if next}}
<a href="{{page_url next}}">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</a>
{{/if}}
</nav>
{{/need_pagination}}
To remove undesired whitespaces, look at Whitespace Control section on the official handlebars site.
Tests
npm test
License
MIT License