Add an option in Pagination class to generate URL without limitstart=0#19467
Add an option in Pagination class to generate URL without limitstart=0#19467mbabker merged 7 commits intojoomla:3.9-devfrom
Conversation
| * @var boolean The flag indicates whether to add limitstart=0 to URL | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| public $append_empty_limitstart = true; |
There was a problem hiding this comment.
Please don't use underscores for property names. Use studly caps (eg appendEmptyLimitstart) like the property above.
Also it may be just me but I always find it a bit contra-intuitive if I have to set a "positive" action ("append") to false to change a default behavior. Why not change the logic and name it "hideEmptyLimitstart" and set it to true if you want to change the behavior. Looks more intuitive to me. But that's probably highly subjective.
There was a problem hiding this comment.
Yes, I was not sure how to call it, I will change it. I also tried to use a setter but simple public variable is easier.
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| public $append_empty_limitstart = true; | ||
| public $hideEmptyLimitstart = true; |
There was a problem hiding this comment.
I think that should be "false" (or null) here.
There was a problem hiding this comment.
Yes, I forgot to change it.
|
Now all should work as expected without any B/C break. Affected views:
Every 3rd party extension can enable that option in model or view by adding: // Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true; |
|
Please apply to |
|
Done |
|
|
| $link_prev = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=&limitstart=' . $page_prev); | ||
| if ($page > 1) | ||
| { | ||
| $link_prev .= '&limitstart=' . ($page_prev - 1); |
There was a problem hiding this comment.
wrong variable name,
$page_prev should be $page
|
Fixed |
|
I have tested this item ✅ successfully on 4c8c189 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19467. |
|
@Bakual Could you approve this PR? Could it go to 3.8? |
|
@csthomas Technically it's a new feature and thus can't go into 3.8.x. It has to go into 3.9.0. |
|
This PR requires one more human test. |
|
I have tested this item ✅ successfully on 4c8c189 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19467. |
|
Ready to Commit after two successful tests. |
|
Can we consider milestone |
|
@csthomas After changing the base branch to |
|
OK, merged |
|
Be aware that |
|
IIRC that's why |
|
Yes, obviously. Travis passed. One more human test please if needed. |
Summary of Changes
SEO impovement for views with pagination.
Add an option to not generate/build URL with empty limitstart -
&limitstart=0I added a few changes in com_content component to show how it can work.
Changes in
pagebreakplugin:&showall=- if someone will see a problem then I will revert it.&limitstart=Testing Instructions
I encourage to review the code. Any improvement is welcome.
You can test a new pagination option on article/category/featured/archive views.
Expected result
No more
&limitstart=0or&start=0in com_content componentDocumentation Changes Required
Every 3rd party extension can enable this feature in model or view by adding: