Facebook not picking up post or blog description when sharing
-
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 https://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!
- The topic ‘Facebook not picking up post or blog description when sharing’ is closed to new replies.