If [[~[[*id]]]] returns the current resource how do I call the previous?

My comprehension of pdotools is fairly weak so I’m looking for an easier way to paginate.

Is there a way to call the previous resource in an href?

If [[~[[*id]]]] is the current resource with an id of 10 (e.g.) how would I can I call resource 9?

Something like [[[[~[[*id]]]]-1]]

I think you could achieve your goal by using an output filter:


// or simply just :subtract as it defaults to -1

Although I would advise against it, as this method inevitably breaks as soon as you create a resource not within you desired id order.

I don’t know your exact usecase but using pdoPage (part of pdoTools) usually works really well. Note that pdoPage will take parameters of pdoResources to define which resources you want to select and paginate.


pdoNeighbors does what you need.

1 Like

Thank you both. Let me investigate.