Next.js Pages Can Silently Lose Their Open Graph Image Through Metadata Overrides
A developer found that 14 pages on their Next.js site lacked a share image without any build error or warning. Next.js merges metadata shallowly, so a page's openGraph object replaces the layout's entire object, dropping the og:image, og:type and site name. The problem is easy to miss because the homepage, which sets no openGraph of its own, still looks correct. The recommended fix is a shared defaults object spread into every page's openGraph, with page-specific values placed after the spread. Developers should also check one page from each route, since social previews may be cached until refreshed.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in