How to insert a facebook like button in a confluence page?

I am trying to add facebok like putton to my confluence page.

Facebook developers gives the code:

I tried to add html using html-include macro, but it doesn't work :S

I want to add social links like atlassian blog does.

How can I do this? Please help.

Thanks for answers.

2 answers

~~~ spam ~~~

2 votes
David Simpson Community Champion Sep 02, 2012

See this reference:

Adapting the HTML5 version of the generated code...

Browse to Confluence Admin | Look & Feel | Custom HTML

In At the end of HEAD, paste:

	var fbLike = '<div class="fb-like" data-href="' + window.location.href + '" data-send="false" data-width="450" data-show-faces="true"></div>';	
	var fbScript = '<div id="fb-root"></div><script>(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return;  js = d.createElement(s); = id;  js.src = "//";  fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</' + 'script>';

You should now be able to like and also post to FB:

This inserts to header, but I want to add wherever I want to use it.

David Simpson Community Champion Sep 03, 2012

Yes, that looks kinda weird. I've made a minor edit to the script and it's working good for me on Confluence 4.2 using Google Chrome and Safari on a OSX Lion.

This approach may be better than the answer by @Bahar Çağlar because it automatically will embed the like button on all Confluence pages/blogposts.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

301 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you