I’ve been wondering this for a while and wanted to check whether I’m being silly and not recognizing things or whether Kirby 4 actually can’t do this yet:
I want to be able to use $pages->paginate() to create… well, a pagination. But I want to be able to have the URLs of the paginated pages be something like /myPage/1/myPage/2 etc.
As far as I can tell, Kirby does have two methods for pagination, query and param, but neither of those work in the way that I would like them to here.
Is there a way to address this? Or is there a really good reason for not enabling this kind of URL and my desire to create such URLs is silly, actually?
I wouldn’t spare myself the hassle personally as the difference to e.g. params is very minor in my view.
BUT, if you want to do this, you’ll need to create custom routes that match your pattern. In the route, you can then use $pages->paginate() on your pages collection with the page number retrieved from your route.
That’s exactly what I do right now, yes. I just thought it might be a good idea to potentially add this to Kirby itself because having the page number be part of the path like this is kinda the most common way of solving this so it gets explicitly requested by clients sometimes.
Making this a general rule, how would you handle use cases where people want to use actual subpages with a number as slug? I don’t think there is a way for Kirby to know which case you’d want, which is why you need to define it as a route yourself.