Add “Page Control” Option to Define First and Other Page Item Counts

Created on 12 July 2025, 3 months ago

Issue Summary

This proposal adds a new “Page Control” feature to the Views Infinite Scroll pager plugin, allowing site builders to specify different item counts for:

  • The first page
  • All subsequent pages

This is useful in UX scenarios where the first page of a listing (e.g., landing pages or featured sections) should show fewer or more items than the rest.

Proposed resolution

  • ntroduce a checkbox Enable Page Control in the pager settings.
  • When enabled:
    • Hide the existing Items per page field.
    • Show two new number fields:
      • Items for the first page
      • Items for the other pages
  • Modify internal pagination logic to:
    • Set per-page limits conditionally based on current page.
    • Adjust offset and total count logic accordingly.
  • Update getRemainingItems() and getNumberItemsLeft() methods to reflect accurate counts.
  • include #states logic in the options form for dynamic field visibility.

User interface changes

A new checkbox and two conditional number fields will be shown in the Views UI under the pager settings.

Example Use Case

For example, I want to display only 4 items on the homepage (page 0), but load 2 items on all other pages. This feature enables that flexibility without needing to override views programmatically.

Video Demonstration

Here’s a working demo of the feature implemented on my site:


Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India mugesh.s Tamil Nadu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024