Issue 196
bug: Share images and post thumbnails never show (duplicate SEO meta field)
Back to our planDone
bugfrontendcmspriority: high
Type
bug
Summary
Every page, post and event is missing its share image, and post cards and sidebar thumbnails show a placeholder. The image editors pick in the SEO tab is saved but never read back, because each of these collections has two meta fields and reads return the one without an image.
Problem
- The collections define their own SEO tab, named
meta, with title, description and image (for examplesrc/collections/Posts/index.ts:131). seoPluginis also givencollections: ['pages', 'posts', 'events'](src/plugins/index.ts:74–78, added in #69). The plugin then adds its ownmetagroup. That group has no image, becauseuploadsCollectionisn't set.- The database stores
meta_image_id(the seed sets it), but the Local API returns the plugin's group. Nothing that readsmeta.imageever gets it:- the Open Graph image in
generateMeta()(src/utilities/generateMeta.ts:28), on every page, post and event; - post cards;
- sidebar thumbnails.
- the Open Graph image in
- This is also why the generated types lack
meta.image: the "SEO plugin type gap" indocs/guidelines/payload-cms.md. - The Payload website template calls
seoPlugin({ generateTitle, generateURL })withoutcollections, because the collections add the fields themselves.
Found in the review of #195 (UI inventory), which reproduced it with a seeded database.
Proposed fix
- Remove
collectionsfromseoPlugin, as in the template, so only the hand-written SEO tab exists. - Run
npx payload migrate:create. If the schema changes, review the migration for data safety. Themeta_image_idvalues must survive. - Run
npm run generate:types, then remove the type workarounds that existed only because of the gap (Card,SidebarPosts,generateMeta,Posts/index.ts).
Acceptance criteria
- Not done:
payload.findon posts, pages and events returnsmeta.image. - Not done: Shared links get the SEO image:
og:imageon a post page is the post's image, not the default. - Not done: Post cards and sidebar thumbnails show the post's image when one is set.
- Not done: No data is lost in the migration, if there is one.
Area
cms, frontend
Priority
priority: high
Generated by Claude Code, opens in a new tab