sverrirs / jekyll-paginate-v2

Pagination Generator for Jekyll 3 (enhanced replacement for the old built-in jekyll-paginate gem) ⛺
https://rubygems.org/gems/jekyll-paginate-v2
MIT License
521 stars 288 forks source link

With offset config, total posts/items is incorrect #242

Open JacksonChen666 opened 2 years ago

JacksonChen666 commented 2 years ago

When an offset is set, paginator.total_posts returns the total posts minus the offset, which does not represent the actual amount of posts.

JacksonChen666 commented 2 years ago

I found this (scroll a bit down for total_posts description) which means the behavior is correct to the description, just not to my expectation (expected 69, got 64 instead of 69 with the set offset of 5) and probably not the jekyll documentation (for v1). I don't see an offset option for v1 pagination, so I don't think this issue can be dismissed because of being v1 backwards compatibility. Though, the solution could be a backwards-incompatible change.

JacksonChen666 commented 2 years ago

Workaround (replace all {{ paginator.total_posts }} with): {{ paginator.total_posts | plus: site.pagination.offset }}