Codeinwp / tweet-old-post

Plugin to tweet about your old posts to get more hits for them and keep them alive.
GNU General Public License v2.0
13 stars 16 forks source link

Featured image is not shared with posts on Facebook #997

Closed vytisbulkevicius closed 1 month ago

vytisbulkevicius commented 1 month ago

Description

This looks to be happening for a while, but when a post is shared on Facebook, the featured image of the post is missing and not shared.

It's not related to recent updates but probably something what Facebook changed in the past.

Featured image is there set for the post: image

Logs: image

Post on Facebook: image

Step-by-step reproduction instructions

  1. Connect your ROP to Facebok account
  2. Have posts with featured images that can be shared (or create new one)
  3. Enable sharing and wait for the post to be shared
  4. Check shared post on Facebook - it doesn't have an image

Screenshots, screen recording, code snippet or Help Scout ticket

No response

Environment info

No response

Is the issue you are reporting a regression

No

AndreeaCristinaRadacina commented 1 month ago

+1 https://wordpress.org/support/topic/facebook-no-featured-images/

girishpanchal30 commented 1 month ago

Hey @vytisbulkevicius,

I've enabled the Share As Image Post setting and it seems to share the post with an image on Facebook. https://tinyurl.com/22ry55za https://tinyurl.com/2dgnm2wo

Social media platforms capture the post image automatically from the og:image meta tag if the above setting is disabled. Ref: https://muffingroup.com/blog/facebook-link-thumbnail-not-working/#:~:text=Why%20is%20my%20Facebook%20link,to%20refresh%20the%20link%20preview.

Thanks

vytisbulkevicius commented 1 month ago

Hi @girishpanchal30,

Thanks for checking. But Share As Image Post is a different thing - https://docs.revive.social/article/958-how-to-share-posts-as-image-posts-to-social-accounts

It was possible to share a post with text preview and also image. Yes, social platforms look for og:image when you just share URL manually but with ROP as we're sharing post from the dashboard we should be looking for attachment somewhere in the code when sharing and using that attachment as image for the post shared. It was working before this way but something was changed how FB accept the parameters I assume.

girishpanchal30 commented 1 month ago

@vytisbulkevicius Okay, I'll debug the code and try to find out the issue.

girishpanchal30 commented 1 month ago

@vytisbulkevicius I've reviewed the code and I think article sharing gets the featured image automatically. I do not see any code related to simple article post sharing with images.

Here: https://github.com/Codeinwp/tweet-old-post/blob/8f4688b3dab6cb90eae09609788899ddf7fd3eb7/includes/admin/services/class-rop-facebook-service.php#L565-L577

I've checked with the live site and it fetch the image automatically.

Ref: https://tinyurl.com/2buccfmu

selul commented 1 month ago

@vytisbulkevicius how is the Share image post different from what you had in mind? I see that Share image post is basically sharing the image with text, which is what you were looking to have?

vytisbulkevicius commented 1 month ago

@selul @girishpanchal30,

So the different between these two are these:

Image Post With this method (and when feature is enabled in ROP) post is shared as an image and where the text is posted, there is title and then the URL added, it looks like this:

image

In this method, if you click on the image on Facebook, you get image opened in gallery:

image

Regular sharing (Text Post):

In this case, image is also fetched but clicking on the image leads you to the article (destination website). It looks like this (it's the same post):

image

Here is also a short guide that covers this difference: https://help.socialpilot.co/article/504-what-is-the-difference-between-image-post-text-post-in-feed-content

I think it's important for the 2nd scenario to work as well as it's more common to want users to open your website clicking the image rather than opening that image in the gallery.

Also, it's interesting that with this post this time it worked for me when testing and image was shared but with another post (and other image used) it did not work and we can see that there are some users complaining about this functionality.

selul commented 1 month ago

@vytisbulkevicius the 2nd scenario is relying on OG tags from what I know, @girishpanchal30 not sure if that controlled from the API call instead of relying on OG tags?

For links that don't have an OG tag we can use https://developers.facebook.com/tools/debug/ to debug why this is happening.

girishpanchal30 commented 1 month ago

Hey @vytisbulkevicius,

The 2nd scenario is sharing Text Post which means facebook generates a link preview automatically. I think we can handle this kind of thing from API.

I used the debug tool to test a few of our live post URLs, but I could not see any problems.

For more details: https://www.blog2social.com/en/faq/content/4/131/en/social-media-post-formats-_-the-differences-between-image-post-and-link-post.html

Thanks

vytisbulkevicius commented 1 month ago

Thank you. I'm closing this then, I thought we have control over it.

I tested those different posts from my test instance and with FB debug tool I also get image in only one of them for some reason (can't spot different in how they are created).

I tried to replace the image on the post where it was not working and then it picked the image so it looks to be about the image itself and maybe the dimensions, size or something else (they are both JPG) of it because it still shows that og:image is not defined but still picks it with another image:

image