Frontend Blocks typescript Intermediate

Next.js Metadata API

Dynamic Open Graph metadata generation per page using the Next.js 14 Metadata API.

typescript
import type { Metadata } from "next";

export async function generateMetadata({ params }): Promise<Metadata> {
  const mod = await fetchModule(params.slug);
  return {
    title: `${mod.title} | NexDevTeam`,
    description: mod.description,
    openGraph: {
      title: mod.title,
      description: mod.description,
      type: "article",
    },
    twitter: { card: "summary_large_image" },
  };
}

Prerequisites

  • next.js >= 14

Pro Tips

  • → Use generateStaticParams to pre-render at build time.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
typescript
Level
Intermediate
Read time
3 min
Published
Oct 2025
License
Commercial License

Newsletter

New modules every week, directly to your inbox.