If you are not satisfied with having just a Digg link on your blog posts, why not add a Facebook bookmarlet?
Here is the code you need (don not let the HTML entities scare you - copy this exactly):
You will want to add this to or below the footer section of your template's posts includible e.g. after the third footer line.<script>
function fbs_click()
{
u=<data:post.url/>;
t=<data:post.title/>;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
<style>
html .fb_share_link {
padding:2px 0 0 20px;
height:16px;
background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?43:26981) no-repeat top left;
}
</style>
<a class='fb_share_link' expr:href='"http://www.facebook.com/sharer.php?u=" + data:post.url' onclick='return fbs_click()' target='_blank'>Share on Facebook</a>
9 comments:
This works so nicely! Thank you!
Even though it worked on mine, the icon (gif) is not in line with the others on my page.
I picked up a bigger icon (http://i261.photobucket.com/albums/ii57/ricardo_hdz/Snap3copy.gif) and tried replacing it but seems the height is restricted and the gif is displayed partly cut from the bottom.
Would appreciate if you could suggest a way out.
http://ayesaala.blogspot.com
Thanks for the code anywhich way.
Good job!
But what about wordpress.com bloggers or other bloggers who are not allowed to embed anything else other than pure html codes in their blogs? In that case, only an html solution is what will do the trick and it can be found here:
How to offer a “Share on Facebook” option under (wordpress.com) blog posts
This button works for Wordpress.
Thanks for the code
For some reason, this is not working for me... Have a simple template and do not know where to place the script...
Hiya,
I was wondering where the data for:
data:post.url
data:post.title
comes fromm. I am hoping to put the link in a non blog site for someone.
Many thanks for the code
Kind Regards
Zen
I couldn't get it to work! :(
Mainly because I couldn't figure out where to put it...all the "footers" I tried just led to the entire code appearing above my navbar.
worked well except I tried to use the info here
http://www.facebook.com/home.php#/share_partners.php
to change what you did to the last option because it is the same as the Share button on facebook and couln't get that to work since I have no real idea what's going on...
would you consider replicating your code of for each of the 4 official styles?
Post a Comment