Balu
1
I am trying to move a collection from the page header to the twig template.
To do so I moved the definition in the header
content:
items: '@self.descendants'
filter:
type: blogpost
order:
by: date
dir: desc
limit: 3
pagination: true
to the twig template as shown in Advanced Collections
{% set options = { items: '@self.descendants', 'filter': {'type': 'blogpost'}, 'order': {'by': 'date', 'dir': 'desc'}, 'limit': 3, 'pagination': true } %}
{% set collection = page.collection(options) %}
But for some reason the pagination doesn’t show up this way unless I specify it in the header again.
content:
pagination: true;
Any hints on what I am doing wrong?
Issue you’ve researched the Grav Pagination Plugin documentation but suggest it just to make sure.
If you have and things still don’t work you could create an issue in that plugin’s repository as it then comes to the attention of the developers.
Balu
3
My issue was that I can’t differentiate if it’s a pagination plugin issue or a grav collection / documentation issue.
According to the example in advanced collections I feel it should work with the options as I set up above.
I now get pagination with the following code:
{% set options = { 'items': '@self.descendants', 'filter': {'type': 'blogpost'}, 'order': {'by': 'date', 'dir': 'desc'}} %}
{% set collection = page.collection(options) %}
{% do paginate( collection, 3 ) %}
But this doesn’t add the required CSS to render the pagination list. I am going to report this as an issue for now.