Skip to content

[5.x] - Change canonical links for paginated pages#1301

Open
JimmyHoenderdaal wants to merge 11 commits into
masterfrom
feature/canonical-pagination
Open

[5.x] - Change canonical links for paginated pages#1301
JimmyHoenderdaal wants to merge 11 commits into
masterfrom
feature/canonical-pagination

Conversation

@JimmyHoenderdaal

@JimmyHoenderdaal JimmyHoenderdaal commented Jun 2, 2026

Copy link
Copy Markdown
Member

Some explanation here:

On product overview pages we have pagination to navigate to pages. In the past we used a <button> tag here instead of an <a> tag. Google prefers <a> with href. This can help Googlebot (the Google web crawler) find subsequent pages.

We already fixed that here.

Next thing Google prefers:

In addition, consider linking from all individual pages in a collection back to the first page of the collection to emphasize the start of the collection to Google. This can give Google a hint that the first page of a collection might be a better landing page than other pages in the collection.

We already do this, so we don't need to change anything here — we can always go back to page 1 from every page. See the screenshot below.

Screenshot 2026-07-22 at 10 32 36

Then the last part for pagination: Use URLs correctly

  • Give each page a unique URL. For example, include a ?page=n query parameter, as URLs in a paginated sequence are treated as separate pages by Google.
    We already do this — when we navigate to the next page, you'll see ?page=2 in the URL.

  • Don't use the first page of a paginated sequence as the canonical page. Instead, give each page its own canonical URL.
    This is what we haven't done yet. When we visit the Rapidez demo and use the pagination, the canonical stays the same: <link rel="canonical" href="https://demo.rapidez.io/men.html">. This should instead be different for every page. So what we've added now is that every page has its own canonical, like this: <link rel="canonical" href="http://rapidez.test/men/tops-men.html?page=3" />.


Also added in this pull request: <link rel="next" href="{{ $pageUrl($currentPageIndex + 1) }}" />. In the past Google used this, but it isn't needed anymore so I removed it in this commit

See also for more info: https://developers.google.com/search/docs/specialty/ecommerce/pagination-and-incremental-page-loading

Comment thread resources/views/layouts/partials/head/pagination.blade.php Outdated
Comment thread resources/views/layouts/partials/head/pagination.blade.php Outdated
Comment thread resources/views/layouts/partials/head/pagination.blade.php
Comment thread src/Models/Category.php Outdated
Jade-GG
Jade-GG previously approved these changes Jun 10, 2026
Comment thread resources/views/category/overview.blade.php Outdated
@Roene-JustBetter Roene-JustBetter changed the title add canonical pagination links [5.x] - Change canonical links paginated pages Jul 22, 2026
@Roene-JustBetter Roene-JustBetter changed the title [5.x] - Change canonical links paginated pages [5.x] - Change canonical links for paginated pages Jul 22, 2026
$pageUrl = fn (int $page) => $page > 0 ? $url . '?' . http_build_query(['page' => $page]) : $url;
@endphp

@section('canonical', $pageUrl($currentPageIndex))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I thought the idea with this was to have the next/prev meta links? With this we only get the current url with the page query param.

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.

4 participants