Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

skip appending page=1 in pagination URLs#55772

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
safaeean wants to merge1 commit intolaravel:12.x
base:12.x
Choose a base branch
Loading
fromsafaeean:patch-1

Conversation

safaeean
Copy link

feat(pagination): omit ?page=1 and prevent dangling separators

Skip adding thepage query parameter when the requested page equals 1, returning the canonical base path instead.

When no extra query parameters are present, the function now suppresses the? /& separator entirely. This prevents URLs such as/users? or/users& and avoids duplicate‑content issues for the first page.

Behaviour for pages >1 and for existing custom query strings is unchanged.

feat(pagination): omit ?page=1 and prevent dangling separatorsSkip adding the `page` query parameter when the requested page equals 1,returning the canonical base path instead.When no extra query parameters are present, the function now suppressesthe `?` / `&` separator entirely. This prevents URLs such as`/users?` or `/users&` and avoids duplicate‑content issues for the firstpage.Behaviour for pages >1 and for existing custom query strings isunchanged.
@crynobone
Copy link
Member

Mark as draft since test are failing.

@crynobonecrynobone marked this pull request as draftMay 19, 2025 08:52
Comment on lines +199 to +206
// Build the query string and attach it to the path
$query = Arr::query($parameters);

return $this->path()
.(str_contains($this->path(), '?') ? '&' : '?')
.Arr::query($parameters)
.$this->buildFragment();
. ($query === ''
? ''
: (str_contains($this->path(), '?') ? '&' : '?') . $query)
. $this->buildFragment();
Copy link
Contributor

@shaedrichshaedrichMay 20, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You might just use theUri class here:

Suggested change
// Build the query string and attach it to the path
$query = Arr::query($parameters);
return$this->path()
.(str_contains($this->path(),'?') ?'&' :'?')
.Arr::query($parameters)
.$this->buildFragment();
. ($query ===''
?''
: (str_contains($this->path(),'?') ?'&' :'?') .$query)
.$this->buildFragment();
return Uri::of($this->path())->withQuery($query)->withFragment($this->buildFragment);

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

@shaedrichshaedrichshaedrich left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@safaeean@crynobone@shaedrich

[8]ページ先頭

©2009-2025 Movatter.jp