Dev Helpers

Next.js / Server search pages

Server keyword summary

Dev Helpers · August 31, 2026

A server-rendered keyword summary can be rebuilt directly from the request URL. Normalize whitespace and handle duplicate query keys deliberately.

Worked example

// app/search/page.tsx

export default async function ServerKeywordSummary({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const q = (await searchParams).q;
  return (
    <main>
      <h1>Search</h1>
      <p>
        {typeof q === "string" && q.trim()
          ? "Results for " + q.trim()
          : "Enter a search term."}
      </p>
    </main>
  );
}

Implementation notes

A query summary is user-controlled text. Render it as text and preserve the source URL when linking to filtered results.

Try it yourself

Open a shared URL with an empty keyword and then with two values.

Open the Next.js example →

Editorial date August 31, 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.