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