Find Questions…

Close ×
First time here? Check out the FAQ!

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

Bahar Çağlar asked this question · 239 karma ·

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.


3 Answers:

Bahar Çağlar · 239 karma ·

How to add a facebook like button in a Confluence page?

1. You should create the code from the facebook developers' page for the page that you want to like.

2. Copy the generated code.
3. Create a confluence page or open editing for an existing one. Add a html-include macro.
4. Paste the copied code into it, and save the page.

5. Here it is!
Similiarly, you can add twitter follow button.

David Simpson · 16,803 karma ·

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:

Bahar Çağlar · 239 karma ·

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

David Simpson · 16,803 karma ·

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.

sdgew sdfwe · 99 karma ·

~~~ spam ~~~

Looking for something else?

Find Questions…

or Browse other questions tagged:

or Ask a Question