Prev/next pagination url in controller from a PaginatedResultSet

Hi,

Cakephp: 5.4
PHP: 8.5
View: Twig

With TwigView, lots of view things should be moved to controller.
StructuredData as LD+json format is build in the controller (with spatie/schema-org:^5.0)

My problem is for CollectionPage Schema type.
They can have a “relatedLink” array for prev and next pages in pagination.

With PaginatedResultSet we have everything to generate previous and next url but this already exists in PaginatorHelper.

Do you know a way to get prev/next url in the controller without rewrite PaginatorHelper::generateUrl() ?

Thanks.

View helpers are already accessible as a Twig functions GitHub - cakephp/twig-view: Twig View for CakePHP · GitHub

Really ? good news …

Anyway, you suggest to add related urls from the twig view ?
Paginator::meta() do this well for tags but adding some “logic” to complete the Structured data object from controller then view sounds not relevant.
Twig approach is also to reduce the logic part from view no ?