• Hello there,

    I can’t get Facebook to use the blog description or each post description when sharing, either through social plugins (Jetpack’s Sharedaddy and Digg Digg) or just by copy/pasting the URL in the Facebook status.

    Right now when sharing on FB it shows the post title where it should show the description, while the image and title are fine. I went through it and found this line in the posts code.

    "<meta property="og:description" content="[whatever the post title is]">

    It’s generated by Jetpack’s Sharedaddy plugging, so I removed the Facebook button from the plugin options and the og:description dissapeared from the code…. but still when sharing the post to Facebook the description was just the title, sharing it either through the buttons from Digg Digg plugin or by copy-pasting
    the URL.

    So I kept searching and I found the generator of the line at plugins/jetpack/modules/sharedaddy/sharing-sources.php:

    public function display_header() {
    		if ( $this->share_type == 'share' ) {
    			// Set the open graph description, otherwise Facebook may pick up some random text from the page
    			global $post;
    
    			if ( $post && $post->ID > 0 )
    				echo '<meta property="og:description" content="'.esc_attr( apply_filters( 'sharing_post_title', $post->post_title, $post->ID, $this->id ) ).'>" />';
    		}

    I edited, and whatever I write is what it shows (meaning: if I make a php call to something it shows the php, not what it should be calling). I tried with these two:

    echo '<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt()); ?>" />';
    
    echo '<meta property="og:description" content="test" />';

    And I got these in the source code of the posts:

    "<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt()); ?>">
    
    "<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt()); ?>">

    But in both cases, when sharing to Facebook the description shown was just the title of the post.

    Any idea what is doing this and how can I remove it? I’m using All in One SEO plugin and I would like it Facebook to pick the description from there and, when there isn’t, just take the first paragraph or so.

    The blog is at http://www.enquepiensauncalcetin.com. I’m using WordPress 3.3.1, and the theme is a free one I edited so I have full access to it.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • First of all, you can’t echo PHP code and then expect PHP to parse it again after it’s been echoed 🙂 Also, it’s not a good idea to edit plugins. The next time the plugin updates, it will overwrite your changes, and you’ll be back to square one.

    I usually just hard-code these meta tags into the header, rather than using a plug-in. The code you posted should work just fine if you put it in the header of your theme, rather than trying to echo it out.

    Thread Starter aderojas

    (@dresde)

    Thanks 😉 No idea what “echo PHP code means”, though!

    The problem is that if I add those tags by hand into the header, then when I use the plugings to share on facebook (I can’t just code that) I feel they are going to either overwrite them or duplicate the tags. Also, when I write an specific description in the SEO plugin I want Facebook to pick that, instead of the default description. It works with Google.

    I understand what All in One SEO ads is my fault, but the default Jetpack Sharing plugin should have this solved!

    Dresde, you pointed me in the right direction, after a few hours of hacking this morning I finally got it to work. The explanation is a bit long, check out: How to fix Jetpack’s broken og:description.

    Hopefully this helps!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Facebook not picking up post or blog description when sharing’ is closed to new replies.