Is there a true way of doing if equal in the Ghost handlebar helpers?
I’m trying to make pagination that has the following
“Prev 1 2 3…10 Next”
The issue here is that once we get to page 9, “Next” and “…10” will be the same thing so I want the “…10” removed when the user is on the next to the last page. I’d need to do something akin to {{^if pages=next}} but not sure how to do that.
This needs to be put inside pagination.hbs. This checks if there is a next page. Since the last page doesn’t have a next page, everything between that code will be removed.
Then with handlebars I doubt you can do it. You’ll probably need some small javascript code for this. You can add your {{pagination}} in a div with data attribute data-total={{pagination.pages}}. Then with js you could remove the element that has that attribute - 1. But with handlebars I don’t think so. I think I can post the code if you can share the pagination.hbs content in here.
I wrote a blog post on how to add custom pagination to Ghost using JavaScript. It may help you get what you need. While the post is about adding Bootstrap navigation, it should provide enough code to get you started.
Ok so after perusing the blog post it seems like you went outside the Ghost implementation of pagination and basically append custom pagination to the DOM via Javascript. Is that correct?