generateMetadata

Each route can export metadata (static) or generateMetadata() (dynamic). The result is injected into <head> as <title>, <meta>, and OpenGraph tags.

Inspect the head

Open devtools → Elements → <head>. You should see <title>Hello carol — bext demos</title> and the matching meta description.

Try ?name=alice or ?name=bob to watch the title regenerate.

Source

// Static form — known at build time
    export const metadata = {
                title: "About bext",
                description: "Static-mode metadata sample",
};
// Dynamic form — receives the same args as the loader
export async function generateMetadata({ searchParams }) {
                const name = searchParams?.name ?? "world";
                return {
                                title: `Hello ${name} — bext demos`,
                                description: `Personalized metadata for ${name}`,
                                openGraph: { title: `Hello ${name}` },
                };
}