Skip to content
SprecherEast
Issue 196

bug: Share images and post thumbnails never show (duplicate SEO meta field)

Back to our plan
Done
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 example src/collections/Posts/index.ts:131).
  • seoPlugin is also given collections: ['pages', 'posts', 'events'] (src/plugins/index.ts:74–78, added in #69). The plugin then adds its own meta group. That group has no image, because uploadsCollection isn't set.
  • The database stores meta_image_id (the seed sets it), but the Local API returns the plugin's group. Nothing that reads meta.image ever gets it:
    • the Open Graph image in generateMeta() (src/utilities/generateMeta.ts:28), on every page, post and event;
    • post cards;
    • sidebar thumbnails.
  • This is also why the generated types lack meta.image: the "SEO plugin type gap" in docs/guidelines/payload-cms.md.
  • The Payload website template calls seoPlugin({ generateTitle, generateURL }) without collections, 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 collections from seoPlugin, 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. The meta_image_id values 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.find on posts, pages and events returns meta.image.
  • Not done: Shared links get the SEO image: og:image on 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

See it on GitHub, opens in a new tab