Wrong criteria when selecting og:images from posts without a Featured Image
-
Hi. In WordPress.com documentation (https://en.support.wordpress.com/facebook-image-thumbnail/) it’s stated that the preference for featured images for posts is:
1. Featured image
2. Uploaded images present in the post content (from top to bottom)
3. No imagesThis disagrees with the Jetpack documentation: https://jetpack.com/tag/open-graph/
I’ll explain with an example, see this post: https://diegoetest.wordpress.com/2016/08/22/ogimage-problems-post/
According to the documentation, and what I would expect to happen, I should see the following og:image priority:
1. Brownies
2. Cupcakes
3. Mario Bros.
4. Yellow background chocolates
5. Cake with berries.However, the gallery images (#4 and #5) are taking precedence over the images in the post.
Looking into Jetpack’s code, it appears that this behavior is following the actual criteria in the code, which is:
1. Featured image
2. Any slideshow in the post
3. Any gallery in the post
4. Attached images, in order (marked as “uploaded to” this post)
5. Images in the post HTML (the actual content)
6. Blavatar, or gravatarhttps://github.com/Automattic/jetpack/blob/master/class.jetpack-post-images.php#L460
I believe the correct behavior should be what the WordPress.com documentation states, because that’s the most obvious and user controllable flow:
1. Any featured image
2. The images in the post HTML, from top to bottom (from the actual HTML)
3. Any slideshow, or gallery
4. Attachments in uploaded orderThe current behavior is problematic because any random gallery can take over more important images in your post og:image tags.
Here’s an example scenario:
1. You write a profile on a writer you like.
2. You insert a big nice portrait as the first image on your post’s content, reasonably you intend this to be the most important image in the post.
3. Many paragraphs later you include a gallery showing all the books you have of said writer.
4. You share the post on Facebook.
5. Your big nice portrait is nowhere to be found, only the random photos of your books are available as og:image options.Expecting users to always set a Featured Image is not an acceptable solution, IMO. Users might not know about the feature, might not care, or might not want to use it because the theme they are using displays featured images in a way they don’t want.
The blog I need help with is: (visible only to logged in users)
-
- The topic ‘Wrong criteria when selecting og:images from posts without a Featured Image’ is closed to new replies.