adding a facebook-like plugin on a kentico page
The normal aspnet way will not work properly as the public web site pages uses page routing and the real page name will be linked to.
Is there a way that i can add the facebook li开发者_运维技巧ke plugin to a kentico page?
You need to grab the CurrentNodeAlias path using the Kentico API. I also grab the domain using standard aspnet properties
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=138739939541536&xfbml=1"></script><fb:like href="<%= Request.Url.GetLeftPart(UriPartial.Authority) +CMS.CMSHelper.CMSContext.CurrentAliasPath%>" send="false" layout="box_count" width="110" show_faces="false" font=""></fb:like>
Note: you will need to add in the namespace for fb in the element something like:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
Note: you have to use the FB like button. This is by design as a security concern.
精彩评论