Blog Sections Open

Fixing Pagination with getResourcesTag and tagLister

Tag-driven listings often work on page 1 and then break as soon as pagination enters the picture.

The donor behind this post showed a tag-based listing built with tagLister, getResourcesTag, and pageNav. The problem was predictable: page one worked, but URLs like ?page=2 and later pages stopped behaving correctly.

Example setup

[[!tagLister? &parent=`0` &sortBy=`tags` &target=`41`]]

[[!getResourcesTag@pagination?
  &element=`getResources`
  &includeTVs=`1`
  &includeTVList=`name`
  &tpl=`list_question`
  &parents=`[[*id]]`
  &limit=`10`
]]
[[!+page.nav]]

What usually causes the break

  • pagination parameters are not preserved across the tag-filter URLs
  • the target page and the tag page disagree about which parameters control state
  • the page navigation helper is rendering links without the tag context

How to think about it

Tag filters and pagination are both state. If they are not generated from the same state model, they drift apart. The stable fix is to make sure that every generated pagination link preserves the current tag selection and every tag link preserves the listing route expectations.

In other words: page navigation must know what is being filtered, not just how many records exist.

Newer post

Filtering Resource Listings by a TV Value with DocLister or Ditto

How to filter a resource list by a TV value in Evolution CMS, with practical examples for both DocLister and Ditto.

Older post

Handling Very Large TV Option Lists in Evolution CMS

What to do when a TV field needs to represent a huge dataset and the default dropdown pattern stops being realistic for editors and performance.