Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the pagination system for SEO #339

Open
kgonella opened this issue Sep 5, 2024 · 0 comments
Open

Improve the pagination system for SEO #339

kgonella opened this issue Sep 5, 2024 · 0 comments

Comments

@kgonella
Copy link

kgonella commented Sep 5, 2024

Problem

When the paginator object is created, the method setNormalizeOutOfRangePages(true) is called arbitrary.
When this normalizeOutOfRangePages is set to true, it allows the pagination to accept any page number, even if it out of range, without raising errors. Internally, the pager calculates the last page number and use it for the rendering.

For example, you have 50 items, with a pagination of 10 per page. The maximum page that you could use is 5.
With this parameter set to true, you can pass page=6 and do not have any error raised by the paginator.

In a context of an admin list, honestly, it not an important issue. But the grid system is also used in front (Product listing) and in this context, it caused a problem on an SEO side. The fact that any page can be used without triggering the not found error can lead to duplicate content of the last page of the list.

Solution
This method call seems to be here since the first commit of the pager system into the grid bundle (8 years).
I didn't find any reasons why it was implemented a first. So we have 2 possibilities, remove it or add a parameter to disable it globally or by route.

I can push a PR, let me know what to do

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

No branches or pull requests

1 participant