Dev Helpers

Next.js / Pagination links

Previous results link

Dev Helpers · February 19, 2026

A previous-page link should preserve active filters and prevent a move below the first page. Construct its query from validated state.

Worked example

// components/PreviousResultsLink.tsx

import Link from "next/link";

export default function PreviousResultsLink({
  page = 2,
  base = "/articles",
}: { page?: number; base?: string } = {}) {
  return page > 1 ? (
    <Link rel="prev" href={{ pathname: base, query: { page: page - 1 } }}>
      ← Previous results
    </Link>
  ) : null;
}

Implementation notes

Preserve only query parameters that remain meaningful on the previous page. A stale cursor may belong to a different filter combination.

Try it yourself

Start on page one, then navigate from a filtered later page.

Open the Next.js example →

Editorial date February 19, 2026 · Published December 6, 2026

Related articles

Free bin volume

Free storage volume depends on consistent dimensions and units. Derive capacity and usage in the same unit before formatting a human-readable summary.

Draft preview indexing

Draft pages need deliberate indexing metadata. An indexing directive controls crawler intent, while access to unpublished material needs a separate permission check.

Party size allocation

Allocating a party into groups is an integer problem. The remainder determines whether another group is needed and how full it will be.