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
- Set
admin.meta.title to a Next.js title object: { default: 'My CMS', template: '%s | My CMS' }
- Start the dev server
- Open the admin dashboard
- Browser tab shows
[object Object] - Payload
Which area(s) are affected?
area: ui
Environment Info
Payload 3.78.0, Next.js 15
Describe the Bug
admin.meta.titleacceptsMetadata['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:.join(' ')stringifies the title object to[object Object]. The same issue applies to theogTitlecomputation 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
admin.meta.titleto a Next.js title object:{ default: 'My CMS', template: '%s | My CMS' }[object Object] - PayloadWhich area(s) are affected?
area: ui
Environment Info
Payload 3.78.0, Next.js 15