gnp

ghost-need-pagination

Custom handlebars helper to show ghost pagination if only it's needed

Showing:

Popularity

Downloads/wk

1

GitHub Stars

0

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Build Status Coverage Status

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial