Support » Plugin: Jetpack by WordPress.com » Publicized post results in ugly links on Google

  • Resolved greatdanemaniac

    (@greatdanemaniac)


    Hi!
    On and off, I’m experiencing sort of the same problem I used to have with Facebook, where the post that’s been shared doesn’t look like it should. The images are missing, and all I get is a really ugly link.

    It used to be the other way around. I never had any problems at all with G+, but then it changed a while back. It’s been going on for several months now.

    The ugly link looks like this:
    http://i.imgur.com/LGJzC1y.png

    This is how it should look:
    http://i.imgur.com/SqsxtH8.png

    I have basically no plugins installed besides Jetpack and Akismet on my site. It’s also a multisite and my other blog in this network also has this issue.

    It rarely happens on FB anymore, thanks to a snippet of code that I found somewhere online. Is it possible this can be changed a bit so I can use it on G+ as well? I really hate these ugly links…

    // Issues with sharing posts on Facebook: http://www.passwordincorrect.com/issue-with-sharing-wordpress-posts-to-facebook/
    
    // Add this chunck of code in your functions.php or anywhere else in your theme files.
    
    // Register action for post status transitions
    add_action( 'transition_post_status' , 'purge_future_post', 10, 3);
    
    // Check if the new transition is publish, for correctness you could check if $old_status == 'pending', but I want that every post (which is published) is cached again (just to be sure).
    function purge_future_post( $new_status, $old_status, $post ) {
        if($new_status == 'publish') {
            purge_facebook_cache($post);
        }
    }
    
    // Ping Facebook to recache the URL.
    
    function purge_facebook_cache($post_id) {
        $url = get_permalink($post_id);
        $fb_graph_url = "https://graph.facebook.com/?id=". urlencode($url) ."&scrape=true";
        $result = wp_remote_post($fb_graph_url);
    }

    Maybe it’s my site that has problems with performance issues, but I tried a few months back to install every site into a single site, and the problems continued. Also I’ve tried connecting and reconnecting without any success. It seems to be happening at total random.

    https://wordpress.org/plugins/jetpack/

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

    (@jeherve)

    Jetpack Mechanic 🚀

    I’m experiencing sort of the same problem I used to have with Facebook, where the post that’s been shared doesn’t look like it should. The images are missing, and all I get is a really ugly link.

    Google+ works like Facebook. When you share a post, either manually or via a tool like Publicize, Google crawls the post URL and looks for tags that can be used to build a post preview.

    Like Facebook, if the crawler fails to load the page and find tags, it gives up and only creates a minimal post preview.

    It rarely happens on FB anymore, thanks to a snippet of code that I found somewhere online. Is it possible this can be changed a bit so I can use it on G+ as well?

    Unlike Facebook, Google+ doesn’t offer any way to purge its cache, I’m afraid (reference). So you won’t be able to implement a solution like the one you posted above (that’s actually a smart way to force Facebook to purge its cache, thanks for posting this here!).

    Looking at your site, you seem to have all the tags needed to build a good post preview. Short of reviewing your posts’ loading time, I’m afraid I don’t have a solution to that problem. Since it happens randomly, it’s going to be hard to pinpoint the exact source of the problem. You could try checking if it happens more with post with lots of pictures, that may take longer to load?

    Thanks for your fast reply!

    Good to know. Perhaps it’s some issues with google+? I’ve noticed that this seems to happen to several bloggers using WordPress and publicizing them to G+ at the same times/days when Im also publishing posts.

    You’re welcome. The snippet works like a charm! Never had an issue since I enabled it.

    I don’t think several images are the problem, but a loading issue could certainly be it. The links I’ve shared with the posts were both instagram photos sent via ifttt.com.

    Maybe I have a bad web host? Oh, well. I guess this is something google have to solve… Or my host.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Publicized post results in ugly links on Google’ is closed to new replies.