Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    When you share a post on Facebook, or when Jetpack Publicize publishes a post to your Facebook page, Facebook crawls the page and looks for Open Graph meta tags in the head to build a complete post preview (with an image, title, description, …).

    Jetpack automatically creates these Open Graph Meta tags for you unless you already use another Open Graph plugin, in which case we let the other plugin handle things.

    One of the tags is an image tag, that Facebook will use to pick the image to use in the post preview. Jetpack follows the following rules when looking for an image to be as an image tag:

    • An image has to be larger than 200x200px to be used as an image tag, as per Facebook requirements.
    • If you’ve defined a Featured Image for your post, Jetpack will only create one image tag, and will ignore all other images in the post. We do so to give you control over the image that is used by Facebook; the featured image is always the most important.
    • If you didn’t define a Featured Image, we’ll start looking for slideshows and galleries in your post. If we find a gallery or a slideshow, and if the images are big enough, each image will be added as an Image meta tag, thus allowing your readers to choose which image they want to share.
    • If you didn’t create any gallery, we’ll look for single images in the post, and use the first one as an image meta tag.
    • If you didn’t add any image, we’ll fall back to your site icon, site logo, and then to a default blank image.

    You consequently should be able to give that option to your readers by creating a gallery, and not setting any Featured Image for that post.

    I hope this helps.

    If you still experience issues, do not hesitate to post a link to one of your posts here, and I’ll take a look!

    Thread Starter Axium

    (@axium)

    Hi Jeremy,

    Thank you very much for this very detailed explanation, it makes perfect sense.

    However, my featured image is being kinda cropped and since it is going to be pieces of clothing in most cases, that’s clearly not the best way to present it on facebook as a first preview… Is there any way I can modify the plugin to make it look for at least another source of media on the product page (wc product gallery in my case) even if there is a featured image ?

    Best,
    FG.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    You can hook into the jetpack_open_graph_tags filter to add your own images to the list of Open Graph Meta Tags provided by Jetpack.

    You could paste the following code in your theme’s functions.php file, or in a functionality plugin:

    function jeherve_add_image_og_tag( $tags ) {
    	if ( is_single() ) {
    		$tags['og:image'] = 'YOUR_IMAGE_URL_HERE';
    	}
    	return $tags;
    }
    add_filter( 'jetpack_open_graph_tags', 'jeherve_add_image_og_tag' );

    You will of course need to replace YOUR_IMAGE_URL_HERE with your product image URL, but I’m not familiar with Woocommerce so I’m afraid I can’t tell you how to query for those images. I’d suggest getting in touch with Woocommerce support on that part.

    Thread Starter Axium

    (@axium)

    Thank you so much, I’ll shoot them an email.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiple meta data images with facebook share button (WC)’ is closed to new replies.