Share Your Blog-Post on Facebook in Liferay

Here is the example of how to customize
<liferay-ui:social-bookmarks>

This tag contain url of different social networking site .if you wish you can add and remove your personalize social networking site.
By default it contain different site like blink list ,digg etc.

Now here we will do sample exercise to add any new site in this list ..
so we will try to add facebook and twitter in this list.

Now to add this two sites in to list you need to add entries in your portal-ext.properties file

In social.bookmark.type you need to specify the site name and below that specify the url to share the data. Url may differ from site to site . Means in Facebook you have to pass a parameter in share.php as u (url) and t (tiltle) . This is the syntax for facebook i am not sure about twitter.

Now when you use <liferay-ui:social-bookmarks> it will also display facebook and twitter in your list.

Now when you click on facebook button to share your blog post or any thing it will pass in this format.

http://www.facebook.com/share.php?u=http://localhost:8080/web/guest/test/-/blogs/firstpost&t=FirstPost
here you can see that in parameter U it will pass current url and in T it will pass title of your post

here problem may arise due to localhost .if you pass localhost in your url than it wont work . You need to pass specific IP address over here .

So for that you need to change in your page.jsp file under this directory tomcat/webapps/root/html/taglib/ui/socialbookmarks

here in your page.jsp it display list of all site under <li> tag . So you need to apply some string operation to modify the url . Remove local host and put your current IP address.

Now you can easily share your data on facebook.......Enjoy,............

Next PostNewer Post Previous PostOlder Post Home