Skip to content

feat(paginator): add custom page name#1162

Open
FlorianV85 wants to merge 3 commits intoadonisjs:22.xfrom
FlorianV85:feat/paginator-page-name
Open

feat(paginator): add custom page name#1162
FlorianV85 wants to merge 3 commits intoadonisjs:22.xfrom
FlorianV85:feat/paginator-page-name

Conversation

@FlorianV85
Copy link
Copy Markdown

@FlorianV85 FlorianV85 commented Mar 22, 2026

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The purpose of this PR is to add the option to customize the page name (Paginator). Currently, metadata generates URLs with a static page query parameter.

Why would this be useful?

  • Generally, it is preferable to give developers the freedom to adapt whatever they need. For example: in a special context, you might need a qs named something other than page. Imagine that you have multiple paginations on the same page.
  • This can simplify the implementation of certain features in some packages, such as Inertia Adapter.

Implementation is very simple:
The custom page name can be defined with a new pageName argument added to the Paginator:

const users = await User.query().paginate(1, 5, 'customPageName')

Now all metadata has the correct URLs with the custom page name.
users?customPageName=x

If no page name is defined, pageName defaults to page.

A test has been added, and it appears to be successful.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant