+321 123 4567
info@test.com
  • Home
  • My Services
    • Web Design
    • Web Development
    • Technical Writing
  • Portfolio
  • My Thoughts
  • Free Tools
    • Photo Editor
    • Avatar Generator
    • Email Migration Tool
    • QR Code Generator
    • RSS to HTML Converter
    • IP Address Geolocation
    • Base64 Image Encoder
    • NATO Translator
    • All Tools
  • Contact
Home
Blogging / Marketing
Fix: Blog Post Sharing on Facebook with No Title & Thumbnail

Fix: Blog Post Sharing on Facebook with No Title & Thumbnail

Wale Adekile
November 5, 2013

If you’re experiencing issues when you share posts on Facebook, it’s obvious some things are not working properly on your blog. When posts are shared or liked, the title may not appear and thumbnails may not even show if you don’t have proper Open Graph meta tags in your head section. It’s proven that posts shared with images and proper formatting gains more interaction on Facebook but when share links appear as shown below, it’s definitely going to have a low CTR.


post sharing on Facebook

There are two fixes that should get things working right:

  1. Debugging your links on Facebook
  2. Adding Open Graph meta tags to your blog’s head section

1. Debugging your links

Once you notice a post isn’t properly formatted when shared, the easiest way to fix this is simply to use the debug tool on Facebook. Basically, this tool lets Facebook access your page and tell you what might be wrong but then, right after debugging the page, sharing it makes it appear properly.

facebook debug

2. Adding Open Graph meta tags to Blogger and WordPress

If you have a lot of errors appearing when you debugged your site, it’s likely you don’t have these required tags in your head section. Apart from Facebook, Google+ and Twitter seem to have adopted it too.


For WordPress:

– Go to Appearance > Editor > Functions.php

– Copy this code and paste it at the bottom:

//Adding the Open Graph in the Language Attributes
function add_opengraph_doctype( $output ) {
return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';
}
add_filter('language_attributes', 'add_opengraph_doctype');
//Lets add Open Graph Meta Info
function insert_fb_in_head() {
global $post;
if ( !is_singular()) //if it is not a post or a page
return;
echo '<meta property="fb:admins" content="YOUR FB PROFILE ID"/>';
echo '<meta property="fb:app_id" content="YOUR FB APP ID" />';
echo '<meta property="og:title" content="' . get_the_title() . '"/>';
echo '<meta property="og:type" content="article"/>';
echo '<meta property="og:url" content="' . get_permalink() . '"/>';
echo '<meta property="og:site_name" content="YOUR SITE TITLE"/>';
if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
$default_image="http://your-site.com/logo.jpg"; //replace this with a default image on your server or an image in your media library
echo '<meta property="og:image" content="' . $default_image . '"/>';
}
else{
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
}
echo "
";
}
add_action( 'wp_head', 'insert_fb_in_head', 5 );

Save your changes.

For Blogger:

– Go to your Template HTML Editor (Template > Edit HTML).

– In the first few lines, you should see this code or something similar:


<html

Better still, press CTRL + F and search for it.

Leave a space and right in front of it, paste this:

xmlns:og='http://opengraphprotocol.org/schema/'

You should now have something like this:

<html xmlns:og='http://opengraphprotocol.org/schema/'

– Now search for <head>

– Just below it, paste this:

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<meta expr:content='data:blog.pageName' property='og:title'/>
<meta expr:content='data:blog.canonicalUrl' property='og:url'/>
<meta content='article' property='og:type'/>
</b:if>
<meta expr:content='data:blog.title' property='og:site_name'/>
<b:if cond='data:blog.postImageThumbnailUrl'>
<meta expr:content='data:blog.postImageThumbnailUrl' property='og:image'/>
<b:else/>
<meta content='http://your-site.com/logo.jpg' property='og:image'/>
</b:if>
<b:if cond='data:blog.metaDescription != &quot;&quot;'>
<meta expr:content='data:blog.metaDescription' name='og:description'/>
</b:if>
<meta content='YOUR FACEBOOK APP ID' property='fb:app_id'/>
<meta content='YOUR FACEBOOK PROFILE ID' property='fb:admins'/>

YOUR FACEBOOK USER ID – Replace this with your Facebook user ID. More details here.

YOUR APP ID – Replace this with your app ID. This article may be useful.

YOUR SITE NAME – Put your site name here

http://your-site.com/image.jpg – Replace with a default image, perhaps your logo

This should fix the issue once and for all. If you’ve got questions, please don’t hesitate to use the comment box.


Previous Post
Adding Facebook Comment to Genesis Without a Plugin
Next Post
Mac vs. PC: Which Of Them Is More Secure?
Wale Adekile
Husband to the world's most beautiful woman and father to two awesome kids. A nerd, obviously; also, a technical business analyst, a web designer who preaches the gospel of WordPress, and a writer. You can check out my published books on Amazon.
ad space selling
Blogging / Marketing

Adsense Vs Selling Ad Space: Which Suits Blogging Better?

12 years ago
Facebook

Hiding Recent Activities (Wall posts, Comments, New Friends) On Facebook

14 years ago

Recent Articles

wahl rapic clip hair clipper
Wahl Rapid Clip Hair Clipper Review: DIY Made Easy
BenQ LaptopBar Review: Luxury or Necessity?
yunmai easepro unboxed
Yunmai EasePro Massage Gun Review
g20
Teendow G20 Robot Vacuum and Mop Review
bathroom
Dear Men, Spraying All Over the Toilet Seat is Disgusting and Irresponsible
winx mediatrans
How to Transfer Photos from iPhone to Computer Without iTunes
google workspace
How to Migrate Emails From Google Workspace/G Suite to cPanel
synology diskstation ds920+
Synology DiskStation DS920+ Review
playstation 4
Why I haven’t Upgraded to the PlayStation 5 Yet
pain
Started Watching Anime as an Adult? You’re Not Alone

All contents on this blog are copyright protected and cannot be reproduced on other websites without permission.

Copyright © 2022 – NerdieDad | Home | Contact | About | Privacy Policy