Reputation: 279
I have facebook button on my site. It looks like:
<span class="fblike" style="float:right;padding-top:5px;margin-left:8px;">
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function()
{
FB.init({appId: 'Your ID#', status: true, cookie: true,xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/sk_SK/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<fb:like layout="button_count" show_faces="false" width="64" action="like" font="arial" colorscheme="light" />
</span>
My problem is, that I can't set og:image which I want :( whereever I place tag . It should be in tag but there is no in my default.php file. I'm working in joomla and it's one of my components.
Upvotes: 2
Views: 4986
Reputation: 896
To display image of your choice on FB wall after all the intializations you should:
Replace your HTML tag with
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
Add og
tags in your head section:
<meta property="og:title" content="title of your page"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="url of your page"/>
<meta property="og:image" content="path of image u want to display"/>
<meta property="og:site_name" content="name of your site"/>
<meta property="og:description" content="some brief description about your page "/>
<meta property="fb:app_id" content="your fb app id"/>
After this you can check the data scrapped from your site using this debugger tool.
If there are no errors or warnings you are all set to use your like button.
Upvotes: 1