Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Next.js 16+ · Type Alias

ResolvingMetadata

ResolvingMetadata types the parent argument of generateMetadata. It provides a promise for metadata resolved by ancestor route segments, enabling a route to inspect and extend inherited metadata.

How it works

ResolvingMetadata is the type of the second argument passed to generateMetadata. It represents a promise for metadata already resolved by parent route segments, which lets a child route inspect and extend inherited values such as Open Graph images before returning its own Metadata object.

Syntax

type ResolvingMetadata = Promise<Readonly<Metadata>>

Parameters

NameTypeDescription
parentResolvingMetadataThe second generateMetadata argument: a promise containing metadata resolved from parent route segments.

Returns

A Promise<Metadata> from generateMetadata; ResolvingMetadata itself represents the promised parent metadata.

Key points

  • The parent value resolves to metadata produced by ancestor route segments.
  • Await parent when you need to merge inherited metadata with route-specific values.
  • The documented pattern safely reads inherited Open Graph images and falls back to an empty array.
  • The function consuming ResolvingMetadata returns a Metadata object, typically through a Promise.
  • Ancestor metadata is processed before metadata from the current, more specific route segment.

Common mistakes

  • Do not use generateMetadata or ResolvingMetadata in a Client Component; metadata generation is supported only in Server Components.
  • The parent argument is asynchronous, so await it before reading inherited metadata.
  • Parent metadata is resolved through the route hierarchy, so the value reflects metadata inherited from earlier segments rather than an arbitrary global object.

Example: Extending parent metadata

import type { Metadata, ResolvingMetadata } from 'next'

type Props = {
  params: Promise<{ id: string }>
}

export async function generateMetadata(
  { params }: Props,
  parent: ResolvingMetadata,
): Promise<Metadata> {
  const { id } = await params
  const previousImages = (await parent).openGraph?.images ?? []

  return {
    title: `Product ${id}`,
    openGraph: {
      images: ['/product.png', ...previousImages],
    },
  }
}

Uses the resolved parent metadata to preserve existing Open Graph images while adding a route-specific image.

When to use it

Merge inherited social metadata

A product or article page needs to retain Open Graph images declared by layouts while adding its own image.

Inspect ancestor metadata

A nested route needs access to metadata established by parent layouts before returning route-specific fields.

Type generateMetadata

A metadata generator must accurately type its second argument in TypeScript.

Interview questions

QWhat does ResolvingMetadata represent?

ResolvingMetadata is the type for generateMetadata's parent parameter. That parameter is a promise containing metadata resolved by parent route segments, allowing the current segment to inspect inherited values.

Follow-up: How would you preserve inherited Open Graph images? Await parent, read openGraph?.images with a fallback, and spread those images into the child route's returned openGraph metadata.

QHow is ResolvingMetadata used in generateMetadata?

A generateMetadata function receives parent as ResolvingMetadata and returns a Promise<Metadata>. The child can await parent and return metadata fields for its own route segment.

Follow-up: Why is the parent value a promise? Metadata resolution follows the route tree, so parent metadata must be resolved before the child can consume it.

QHow does metadata resolution proceed through nested routes?

Metadata is evaluated from the root route segment toward the segment nearest the final page. A child can therefore extend metadata inherited from layouts instead of replacing useful values blindly.

Follow-up: What restriction applies to this API? Both static metadata and generateMetadata are supported only in Server Components.

  • Metadata
  • generateMetadata
  • metadataBase
  • openGraph

Source: Next.js. Checked 2026-10-15.