Setting Canonical URLs for SPA Pagination

Pagination and faceted filtering are where SPA canonical strategy gets subtle: page two of a listing is not a duplicate of page one — it contains different items — yet a sort parameter usually is a duplicate. Treating them the same is how sites either lose deep pages from the index or bloat it with near-identical filter URLs. This page gives the rules for paginated and filtered routes, extending canonical URL management.

Step-by-step fix

  1. Self-canonicalize each paginated page. Page two points at page two, because it lists different content.

    <!-- ✅ On /products?page=2 -->
    <link rel="canonical" href="https://example.com/products?page=2">
    <!-- ❌ Do NOT canonicalize page 2 to page 1 — its items would never be indexed -->
  2. Canonicalize non-unique filter/sort states to the clean URL. A re-sorted list is the same content in a different order.

    <!-- ✅ On /products?sort=price (same items, reordered) -->
    <link rel="canonical" href="https://example.com/products">
  3. Keep pagination crawlable with real links. Crawlers must be able to reach deeper pages without executing click handlers.

    <!-- ✅ Crawlable pagination -->
    <a href="/products?page=2" rel="next">Next</a>
  4. Set these in the rendered head per route, mutating a single canonical tag as the user paginates — reuse the manager from fixing duplicate canonical tags.

Validation

  • Each paginated page reports itself as the user-declared canonical in URL Inspection.
  • Sort/filter variants report the clean listing URL as canonical.
  • site:example.com/products returns distinct paginated pages, not just page one.
  • Coverage report shows deep pages indexed, not marked as duplicates.

Reference

// Decide the canonical for a listing route
function canonicalForListing({ path, page, sort, filter }) {
  const base = `https://example.com${path}`;
  if (page && page > 1) return `${base}?page=${page}`; // self-canonical: unique items
  // sort/filter that don't create unique content → clean URL
  return base;
}

Frequently Asked Questions

Should paginated pages canonicalize to page one? No. Each paginated page should self-canonicalize, because page two contains different items than page one. Canonicalizing every page to page one tells Google the deeper pages are duplicates, and the items only listed there may never be indexed.

How should I handle filter and sort parameters? Filter and sort states that do not create meaningfully unique content should canonicalize to the clean listing URL. States that do produce unique, search-worthy content can self-canonicalize, but be conservative to avoid index bloat.

← Back to Canonical URL Management in SPAs