getgrav / grav-plugin-pagination

Grav Pagination Plugin
https://getgrav.org
MIT License
27 stars 20 forks source link

Pagination of filtered collection #28

Closed akaunderr closed 6 years ago

akaunderr commented 6 years ago

I can not found any solution for my problem. It looks like pagination issue. If i use pagination and my collection is filtered like {% set collection = page.collection().ofType('note') %} i have a wrong pagination which includes an empty page. For exampe: I have page with limit:3 and 8 children, my page.collection includes 8 items and page should dispalys 3 subpages. After filtering i get only 4 items in my collection and i expect that i will get 2 subpages with 3 and 1 items. But they are still 3, and there are empty subpages.

rhukster commented 6 years ago

The proper way to do this is to take advantage of the new filtering options that were added recently for Grav collections. This has yet to be documented (i'm getting to it!), but in the meantime here's an example:

content:
  items: '@self.children'
  filter: 
      type: note
akaunderr commented 6 years ago

Thank you for your quick answer! I've been trying to solve this problem in the last few days. Can I post this decision on the Grav forum despite the fact that is not yet documented?

rhukster commented 6 years ago

Of course, its on my "bit list of things to document" https://github.com/getgrav/grav-learn/issues/356

Just not gotten around to it yet.. busy busy!