2

This might sound counter-intuitive, but I'm trying to set a specific limit; if the currentPage is the first paginated entry.

{% set limit = paginate.currentPage == 1 ? 5 : 8 %}
{% paginate craft.entries.section('news').limit(limit) as articles %}

I know this isn't going to work because I'm querying the paginate tag before I've set it.

So is there a way to set a custom limit for the first page only?

4

Ok, so after discovering the getPageNum request, I found the following solution:

{% set pageNumber = craft.request.getPageNum %}
{% set firstPageLimit = 5 %}
{% set defaultLimit = 8 %}
{% set limit = pageNumber == 1 ? firstPageLimit : defaultLimit %}
{% set offset = pageNumber == 1 ? 0 : firstPageLimit - defaultLimit %}
{% paginate craft.entries.section('news').limit(limit).offset(offset) as articles %}
| improve this answer | |

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.