Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Facebook Like Button

Go to End

5 Posts   4094 Views


Community Member, 6 Posts

20 May 2010 at 2:54pm

Has anyone integrated the Facebook Like button with the blog module?


Forum Moderator, 5523 Posts

30 November 2010 at 7:31pm

Yes - we have on Its really easy. Use the facebook tool to generate the iframe code. For we altered the template (blog/templates/Includes/) and the template (blog/templates/Layout/

Rather than edit those files directly in blog/ you should copy them to your current theme. Keep the location of the file in your theme the same as it is in the module (i.e BlogSummary should be copied from blog/templates/Includes/ to themes/yourthemename/templates/Includes) then you can edit it as much as you wish using your text editor

For I added the following

<iframe src="{$AbsoluteLink}&amp;layout=button_count&amp;show_faces=false&amp;width=150&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>

The only really SS specific part of that (that's mostly straight from facebook) is the $AbsoluteLink in the ?href part. This passes the full URL to the current page.

And to add a tweet button is similar. This is the code I used for tweets in the template

<a href="" class="twitter-share-button" data-text="$Title" data-url="$AbsoluteLink" data-count="horizontal" data-via="silverstripe" data-related="dawnapp">Tweet</a>
<script type="text/javascript" src=""></script>

Again this mostly comes from Twitter but the $Title and $AbsoluteLink send information about the page to twitter.

Any question feel free to ask :)


Forum Moderator, 435 Posts

9 December 2010 at 2:41am

It works for me.


Community Member, 3 Posts

29 January 2011 at 6:26pm

Hi Willr, I tried the Iframe code, but it doesn't work for multiple "facebook like button" in one page...I tried the XFBML code and it works..
<script src=""></script><fb:like href="$FBBlogURL" layout="button_count" show_faces="false" width="450"></fb:like>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html lang="$ContentLocale" xmlns="" xmlns:og="" xmlns:fb="">

see the link for more info:


Community Member, 57 Posts

27 May 2011 at 2:15am

xfbml code works fine when we are on .SS file.

Can I add <fb:like > </fb:like> in the html content?

I have tried adding these codes but no effect

HtmlEditorConfig::get('cms')->setOption('extended_valid_elements', 'fb:like[href|show_faces|width|height|stream|header|send|font]');