<p>Pulling it all inside paginate fixed it:</p>

<pre><code>{% paginate craft.entries().section('events').limit(2).order('startDate asc') as events %}

{% for event in events %}
    // Event content
{% endfor %}

{% if paginate.prevUrl %}&lt;a href="{{ paginate.prevUrl }}"&gt;Previous Page&lt;/a&gt;{% endif %}
{% if paginate.nextUrl %}&lt;a href="{{ paginate.nextUrl }}"&gt;Next Page&lt;/a&gt;{% endif %}
</code></pre>

CC BY-SA 4.0
2019-05-08T22:34:10.767Z
2019-05-08T22:34:10.767Z
Bryce
<p>I'm trying to paginate a bunch of events based on their start date. The order part is working correctly, but each consecutive page just loads the exact same entries. My code:</p>

<pre><code>{% set events = craft.entries().section('events').limit(2).order('startDate asc') %}
{% paginate events as pageInfo, pageEntries %}

{% for event in events %}
    // Event content
{% endfor %}

{% if pageInfo.prevUrl %}&lt;a href="{{ pageInfo.prevUrl }}"&gt;Previous Page&lt;/a&gt;{% endif %}
{% if pageInfo.nextUrl %}&lt;a href="{{ pageInfo.nextUrl }}"&gt;Next Page&lt;/a&gt;{% endif %}
</code></pre>

<p>What am I missing?</p>

<craft3><pagination><query>
Paginate entries ordered by a custom date field
# Paginate entries ordered by a custom date field

(Asked by: username_0 on 2019-05-08)

I'm trying to paginate a bunch of events based on their start date. The order part is working correctly, but each consecutive page just loads the exact same entries. My code:
{% set events = craft.entries().section('events').limit(2).order('startDate asc') %}
{% paginate events as pageInfo, pageEntries %}

{% for event in events %}
    // Event content
{% endfor %}

{% if pageInfo.prevUrl %}Previous Page{% endif %}
{% if pageInfo.nextUrl %}Next Page{% endif %}

What am I missing?

**Tags:** craft3, pagination, query


---

## 1 answers

### Answer by username_0 on 2019-05-08. Score: 2

Pulling it all inside paginate fixed it:
{% paginate craft.entries().section('events').limit(2).order('startDate asc') as events %}

{% for event in events %}
    // Event content
{% endfor %}

{% if paginate.prevUrl %}Previous Page{% endif %}
{% if paginate.nextUrl %}Next Page{% endif %}


---

