ProCodebaseProCodebase
  • ModusA Growth OS for your business, on WhatsAppKiosqSell more. Chase less.AI InterviewerAutomated screening & AI-led interviewsXperto AIAI prep companion for candidatesAI Tools HubResume builder, learning paths & more
  • Pre-Vetted DevelopersScreened, scored and ready to interviewAI-Native DevelopersSenior engineers on an hourly basis
  • Services
  • Features
  • Jobs
  • FAQs
Sign inBook a demo
  • Services
  • Features
  • Jobs
  • FAQs
Sign inBook a demo
ProCodebaseProCodebase

ProCodebase Technologies builds AI products for hiring and growth, and ships software for clients as a technical consultancy. We source, screen and deliver pre-vetted developers — so you only interview high-signal candidates.

Products

  • Modus
  • Kiosq
  • AI Interviewer
  • Xperto AI
  • AI Tools Hub

Hire & build

  • Pre-Vetted Developers
  • AI-Native Developers
  • Technical Consultancy
  • MVP Development
  • Features

Resources

  • Articles
  • Topics
  • Certifications
  • Collections
  • Jobs

Company

  • About Us
  • Contact Us
  • Book a Demo
  • FAQs

© 2026 ProCodebase Technologies. All rights reserved.

  • Privacy Policy
  • Terms & Conditions
  • Refund & Cancellation

Level Up Your Skills with Xperto-AI

A multi-AI agent platform that helps you level up your development skills and ace your interview preparation to secure your dream job.

Launch Xperto-AI

Dynamic Generate Metadata in Next.js 14

author
Generated by
Abhishek Goyan

25/07/2024

Next.js

Sign in to read full article

Next.js 14 introduces a generateMetadata function that allows you to dynamically create metadata for each route. you need to add this to you page.tsx file.

export async function generateMetadata({ params }) { const { slug } = params; const data = await fetchData(slug); //API call to get the data const title = data.title; const description = `Discover insightful information about ${title}. Dive into details and explore more.`; const ogTitle = data.ogTitle || title; const ogDescription = data.ogDescription || description; const twitterTitle = data.twitterTitle || title; const twitterDescription = data.twitterDescription || description; return { title, description, openGraph: { title: ogTitle, description: ogDescription, url: `https://yourwebsite.com/${slug}`, type: 'article', }, twitter: { card: 'summary_large_image', title: twitterTitle, description: twitterDescription, }, }; }

generateMetadata Function: This function fetches page data based on the slug parameter and returns a metadata object with properties like title, description, openGraph, and twitter.

Popular tags

Next.jsgenerateMetadatametadata

Share now!

Like & bookmark

Related collections

  • Next.js 14 Performance Mastery

    08/09/2024 · Next.js

  • Mastering Next.js 14: App Router Deep Dive

    02/10/2024 · Next.js

Related articles

  • Static vs Dynamic Rendering in Next.js 14

    02/10/2024 · Next.js

  • Server Actions

    02/10/2024 · Next.js

  • Mastering Middleware in Next.js 14 App Router

    02/10/2024 · Next.js

  • Creating an Action Sheet with Ellipsis Icon in a Scrollable Div

    06/11/2024 · Next.js

  • Understanding Next.js 14

    08/09/2024 · Next.js

  • Optimizing Data Fetching with React Server Components and Next.js 14

    08/09/2024 · Next.js

  • Unleashing the Power of Dynamic Metadata

    02/10/2024 · Next.js

Popular category

  • Python
  • Generative AI
  • Machine Learning
  • ReactJS
  • System Design