Skip to main content

1. Static Metadata Export

Most layouts and pages define metadata by exporting a metadata object. This object typically includes at least a title and description.

Example: app/layout.tsx

Example: app/main/layout.tsx

Example: app/(content)/blogs/page.tsx

Example: app/(content)/privacy-policy/page.tsx

2. Dynamic Metadata with generateMetadata

For dynamic routes, metadata can be generated at runtime using the generateMetadata async function. This is useful for pages where the title, description, or OpenGraph data depend on fetched content.

Example: app/(content)/blogs/[id]/page.tsx


🔄 How to Change or Update Metadata

To update the metadata for any page or layout, simply edit the metadata export or the generateMetadata function in the corresponding file.

To update static metadata:

  1. Open the relevant file (e.g., app/layout.tsx).
  2. Edit the metadata object:

To update dynamic metadata:

  1. Open the file with a generateMetadata function (e.g., app/(content)/blogs/[id]/page.tsx).
  2. Edit the logic or returned values as needed:
Note: Only fields and patterns already present in the codebase are supported. For more options, refer to the Next.js Metadata docs.