From
layout and page files that are Server ComponentsNext.js reads the Metadata API only from layouts and pages, and only in Server Components. The tempting "From any component file, including Client Components" is wrong. A file with "use client" cannot export metadata, so move the client logic into a child component.