Craft is no longer handling my pagination properly. This follows an update from somewhere around 3.4 to 3.7.X.
{% set entries = craft.entries.section(sectionName)
.orderBy('postDate DESC')
.relatedTo(relatedElement)
.with ( ['thumbnail'] )
.limit(10)
%}
sectionName and relatedElement are set earlier in the template. I'm getting correct URLs, like:
- /blog/category/rens-nrens/
- /blog/category/rens-nrens/p2 and the route I have set up is working, but Craft keeps showing me the first page of results.
{% paginate entries as pageInfo, pageEntries %}
...
{% if pageInfo.totalPages > 1 %}
<div class="pagination">
More:
<a href="{{ pageInfo.firstUrl }}" title="First page of news">First</a>
{% for page, url in pageInfo.getPrevUrls(3) %}
<a href="{{ url }}">{{ page }}</a>
{% endfor %}
<span class="active">{{ pageInfo.currentPage }}</span>
{% for page, url in pageInfo.getNextUrls(3) %}
<a href="{{ url }}">{{ page }}</a>
{% endfor %}
<a href="{{ pageInfo.lastUrl }}" title="Last page of news">Last</a>
</div>
{% endif %}
...
{% set entries = craft.entries.section(sectionName)
.orderBy('postDate DESC')
.relatedTo(relatedElement)
.with ( ['thumbnail'] )
.limit(10)
%}
{% for item in entries %}
various other bits...
<p>{{ item.teaser }}</p>
{% endfor %}
{% paginate entries as pageInfo, pageEntries %}
{% paginate entries as pageInfo, pageEntries %}
tag?{% for entry in pageEntries %} ... {% endfor %}
which actually outputs the entries. what you show is just the pagination, right? On another note: did you try to explicitly setpageTrigger
in the general config settings? craftcms.com/docs/3.x/config/config-settings.html#pagetriggerpageTrigger
) parameter explicitly maybe fixes it. In this case thats not the problem, just a thought.