Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Adam Victor Nazareth Brandizzi
Adding Twitter and Facebook buttons to web contents
November 27, 2011 1:29 PM
Answer

Adam Victor Nazareth Brandizzi

Rank: Junior Member

Posts: 67

Join Date: April 30, 2010

Recent Posts

Hello, all!

It is common to have to add Twitter and Facebook buttons in articles in Liferay. How do you do it? For example, the buttons below where added through special web content template and structure, but it was pretty annoying to do, mostly because the Facebook buttons require some <meta> tags.



It is possible to use <liferay-ui:social-bookmarks> (e.g. in a hook) but this tag is not really elegant and does not support Twitter and Facebook on the fly. One can configure the tag to support it but the result is confusing, the buttons are not as beautiful as the ones in the image above, and will not open a nice popup window.

How do you add such Twitter and Facebook buttons to your web contents? Do you use some template and structure? A hook with some code? What are your suggestions?

Thanks in advance!
Hitoshi Ozawa
RE: Adding Twitter and Facebook buttons to web contents
November 17, 2011 3:43 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

It depends on what and how you want to do it.
If's it's just for one web content page, I think you can just select to use "html" as an editor and select "code" to cut & paste button codes.
Adolfo Benedetti
RE: Adding Twitter and Facebook buttons to web contents
November 17, 2011 4:16 PM
Answer

Adolfo Benedetti

Rank: Junior Member

Posts: 45

Join Date: June 3, 2009

Recent Posts

Adam,

If the integration is simple like facebook's like button or "tweet this", would be enough using templates and structures for the articles;

 1....
 2<div id="social"> 
 3<div id="twitter">
 4<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a>
 5<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
 6</div>
 7<div id="facebook">
 8<iframe src="http://www.facebook.com/plugins/like.php?href=$request.attributes.CURRENT_COMPLETE_URL&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe></div>
 9</div>
10</div>
11...
Nelson Jumbo
RE: Adding Twitter and Facebook buttons to web contents
February 14, 2012 12:57 PM
Answer

Nelson Jumbo

Rank: New Member

Posts: 2

Join Date: February 14, 2012

Recent Posts

hi, im trying to add facebook, twitter and google+ buttons within a template.
But i have the next problems:
The facebook button does not work on firefox, a pop up is displayer and after i login the pop up goes blank
the google+ button show a pop up to make a comment, but is closed immediatly
the tweet button, allows me to tweet but counter is not working,.


thanks a lot.