Skip to content

admin.meta.title does not support Next.js metadata title object #16111

@jhb-dev

Description

@jhb-dev

Describe the Bug

admin.meta.title accepts Metadata['title'] from Next.js, which includes the object form { default, template }. However, passing an object results in [object Object] being rendered in the browser tab title.

The issue is in packages/next/src/utilities/meta.ts#L46-L48:

const metaTitle: Metadata['title'] = [incomingMetadata.title, titleSuffix]
  .filter(Boolean)
  .join(' ')

.join(' ') stringifies the title object to [object Object]. The same issue applies to the ogTitle computation on line 50.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/packages/next/src/utilities/meta.ts#L46-L48

Reproduction Steps

  1. Set admin.meta.title to a Next.js title object: { default: 'My CMS', template: '%s | My CMS' }
  2. Start the dev server
  3. Open the admin dashboard
  4. Browser tab shows [object Object] - Payload

Which area(s) are affected?

area: ui

Environment Info

Payload 3.78.0, Next.js 15

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions