{% paginate %} tag takes current subpapage number from url address. Can this behaviour be bypassed and page number be passed directly into {% paginate %} tag?


If you're looking to display a set of Elements that simulate a paginated query, you might actually be looking for the offset Query parameter.

Here's an example of fetching a “page” of results based on a number of entriesPerPage and the number of pagesToSkip:

{% set customPageOfEntries = craft.entries()
    .offset(entriesPerPage * pagesToSkip)
    .all() %}

Of course, this doesn't include the ability to see how many pages of results you have, or to generate links to other pages of results.

  • Thank you for reply. Unfortunetly I cant use this method - i still have to use actual paginate tag, because I need "pageInfo" to create pagination links.
    – piotrpog
    Nov 18 '18 at 19:34
  • I think I might need some more context—you can still paginate the normal set of results, separately, and just run this query off to the side (and use information in your pageInfo variable: docs.craftcms.com/v3/dev/tags/…) Nov 19 '18 at 21:15
  • I guess i could do that, but some of pageInfo variables would be wrong, for example url of next subpage.
    – piotrpog
    Nov 21 '18 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.