• Resolved Platoscave

    (@platoscave)


    Hi,

    I discovered that LinkedIn is not using the og:image that we are setting using Yoast, it is using another image on the page. In the LinkedIn debugger (https://www.linkedin.com/post-inspector/) It says ‘Note: We used the value from the provided oEmbed tag on the page.’ It also then says:
    ‘How to change the image
    Provide a metadata tag for the og:image in the page’s head section. For example:
    <meta name=”image” property=”og:image” content=”[Image URL here]”>’

    Yoast is setting this on our website correctly and is being used by Facebook etc, but LinkedIn isn’t using it.

    So i have checked the /wp-json/oembed/1.0/embed?url=example.com&format=xml and the image that is being used by LinkedIn is set this file like so:
    <thumbnail_url>https://www.images.com/image-name.jpg</thumbnail_url&gt;

    In this Yoast article here: https://yoast.com/advanced-technical-seo-social-image-ogimage-tags/ it says the following:

    ‘Frustratingly, if there’s oembed functionality enabled on a page (as is often the case with WordPress sites), LinkedIn with often retrieve the values from that embed code. Rather than any on-page values.

    This took some rather painful debugging. But we were thankfully able to fix the problem in Yoast SEO by also rewriting the oembed values to match the on-page values (or disabling / conditionally routing oembed).’

    So my question is, is there functionality in Yoast that is meant to be updating the information being set in the oembed file and it’s broken, or is there something wrong with our particular setup that is breaking this functionality? Is there some manual way of overriding the information being set in the Oembed file using Yoast, or do you have some helpful php function that can set what the Oembed information should be?

    I found a plugin here: https://www.sitepoint.com/customizing-wordpress-oembed-content/ that is meant to update the oembed content, but it seems excessive to implement a plugin to change some so simple.

    Any help you could provide would be greatly appreciated.

    • This topic was modified 3 years, 8 months ago by Platoscave.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi @platoscave,

    The problem you mentioned with the oEmbed data was marked as fixed in the 14.0 Yoast SEO release.

    If you’re seeing this problem in the latest version of Yoast SEO and WordPress, we’d like to take a closer look.

    Can you send us an example URL or a link to a screenshot that shows the problem?

    Thread Starter Platoscave

    (@platoscave)

    Hi Priscilla,

    Thank you very much for getting back to me so quickly, I really appreciate it. We are running the latest version of Yoast 15.9.1 and are seeing this issue.

    I think you can see the issue here in the Linkedin Debugger:
    https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fwww.humancondition.com

    The share image url is that is being set via Yoast in the og:image field is: https://images.wtmfiles.com/WTM-homepage-logo-share_WEB_1200x630.jpg
    You can see that Linkedin can see this image, but has chosen to use the image from the /wp-json/oembed/1.0/embed file which is setting this image https://images.wtmfiles.com/main/The-interview-jeremy-griffith-craig-conway-desktop-1015px-no-text.jpg as the ‘thumbnail_url’.

    Please let me know if you need anything further. Thank you again for your time and help.

    Plugin Support Suwash

    (@suascat_wp)

    @platoscave Does this issue occurs on other posts and page URLs or only the homepage?

    Thread Starter Platoscave

    (@platoscave)

    Hi Suwash,

    Yes, it does appear to just be the home page.

    @platoscave

    We are having a difficult time reproducing the issue. We are using WordPress v5.6.2 with Yoast SEO v15.9.1.

    1. We created a page and went to Settings-Reading and made it by the homepage.

    2. We added a featured image which shows up in the backend as the og:image. See image: https://ibb.co/8DwqwtK

    3. We checked the source code and can see the og:image tag is showing the image correctly. See image.https://ibb.co/X35MSBQ

    4. According to this fix we should see the og:image tag appear as the oembed thumbnailimage.

    We went to the URL to check the oembed and we can see it showing the right thumbnail for LinkedIn to use. See imageL https://ibb.co/SBS48Rw. This tag is the exact same one we set-up as the og:image tag.

    However, we checked the link on your site here: https://humancondition.com/wp-json/oembed/1.0/embed?url=www.humancondition.com&format=xml and we can see the thumbnail image is pointing to https://images.wtmfiles.com/main/The-interview-jeremy-griffith-craig-conway-desktop-1015px-no-text.jpg?width=710&quality=50.

    This is different than what the og:image tag is outputting here https://www.humancondition.com. See image: https://ibb.co/WDst47r.

    We are not sure why they are different. We would expect the Oembed thumbnail tag to be the same as the og:image tag on your site. We would like some more information.

    1. Can you confirm you are using WordPress 5.6.2? You can check by clicking on the W in the top left and selecting About. If you need to update, please check with your host provider.?Please know that if you are using an older version of WordPress Core you may experience unexpected behavior with Yoast.?This guide explains more:?https://yoast.com/why-we-dont-support-old-wordpress-versions/.

    2. We had another recent release. Can you confirm you are using the most recent Yoast SEO, v15.9? If you update, does the issue resolve?

    3. Are all your non-Yoast plugins and themes also updated?

    4. Can you elaborate more on how those images have been added to the site? Is one a featured image and the other is an image on the page? Are you able to take a screenshot of how the images have been added? You can use a tool like: https://imgbb.com/ to share the image.

    5. Are you using a pagebuilder like WPBakery, Elementor, SiteOrigin or Divi etc. to create pages? Or is the page created using custom fields such as from Advanced Custom Fields (ACF)? Or is through some other method?

    Thread Starter Platoscave

    (@platoscave)

    Hi @pcosta88,

    Thank you very much for looking at this. I’m sorry for the trouble.

    The site is on 5.6.2.
    Yoast is on 15.9.1.

    Because we want to use an image from our CDN and not from the wordpress image library, we use a custom field to set the og:image, see the following function, it was taken from here: https://gist.github.com/amboutwe/811e92b11e5277977047d44ea81ee9d4

    /* Change Open Graph image URLs in Yoast SEO
     * Credit: Yoast Development team
     * Last Tested: Jul 04 2018 using Yoast SEO 7.7.3 on WordPress 4.9.6
     */
    add_filter( 'wpseo_opengraph_image', 'change_opengraph_image_url' );
    add_filter( 'wpseo_twitter_image', 'change_opengraph_image_url' );
    function change_opengraph_image_url( $url ) {
      if (isset($GLOBALS['SOCIAL_SHARING_IMAGE'])) {
        return 'https://images.wtmfiles.com/' . $GLOBALS['SOCIAL_SHARING_IMAGE'];
      }
        return $url;
    }

    We are using beaver builder.

    Thanks again for your time and help.

    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    Thanks for sharing the relevant code snippet with us. We received a confirmation from our development team about it and it turns out, LinkedIn doesn’t use the og properties but uses the oEmbed from the relevant page.

    We are afraid to say that there’s not much we can do about it as our development team has already optimized the plugin to match everything closely as possible for both og and oEmbed. So, if you want LinkedIn to use the og properties rather than oEmbed, you’ll need to disable oEmbed completely on your website. However, it will then break embedding functionalities as well.

    Thread Starter Platoscave

    (@platoscave)

    Thanks for the update Md,

    As I pointed out in my initial post, in the Yoast documentation here: https://yoast.com/advanced-technical-seo-social-image-ogimage-tags/
    It says the following:

    ‘Frustratingly, if there’s oembed functionality enabled on a page (as is often the case with WordPress sites), LinkedIn with often retrieve the values from that embed code. Rather than any on-page values.

    This took some rather painful debugging. But we were thankfully able to fix the problem in Yoast SEO by also rewriting the oembed values to match the on-page values (or disabling / conditionally routing oembed).’

    So the question I am asking is does Yoast rewrite the oembed values in the /wp-json/oembed/1.0/embed file or not? The yoast docs say that it should, and if it should, my question is why isn’t it on our site?

    Thanks very much.

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi,

    The Yoast SEO for WordPress plugin should rewrite the oembed values to use the og:image tag as the thumbnail_url.

    It’s possible this might be an issue with the implementation of the wpseo_opengraph_image filter on your site.

    If you were to temporarily not use this filter but instead set a specific og:image in the Social tab of the Yoast SEO meta box for your homepage, could you then check and confirm if the thumbnail_url in the oembed file copies the open graph image URL?

    Thread Starter Platoscave

    (@platoscave)

    Hi Michael,

    Yes it works when the image is set in the Yoast SEO meta box, which is good news, but because of our workflow, we don’t want to have to use an image from the WordPress image library (ie we want to use a url to set the image from our CDN) and we want to set the image programatically. Is there a method you can suggest that will allow us to set the OG image programatically that will still allow Yoast to update the oEmbed file?

    Thanks again very much for your time and help.

    Hi @platoscave,

    You can override the oEmbed thumbnail_url, thumbnail_width, and thumbnail_height using the WordPress hook oembed_response_data. There are more details in its WordPress Code Reference article.

    You can see how Yoast SEO uses this hook here in the code on GitHub and you can override this by using a higher filter priority number like 11.

    If you think that Yoast SEO should automatically apply the wpseo_opengraph_image filter to the oEmbed data or provide a better way to set the oEmbed images, we recommend creating a new feature request.

    Thread Starter Platoscave

    (@platoscave)

    Hi again Priscilla,

    Thanks for this, it makes sense and is very helpful. I appreciate all you and your teams time and help on this, I think that gives me everything I need.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Setting Oembed data using Yoast (LinkedIn share image not using og:image)’ is closed to new replies.