Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Best way to create a share to facebook button View modes: 
User avatar
Member
Member
lwhittemore-emh - 2/3/2014 8:17:19 AM
   
Best way to create a share to facebook button
I have a site with a share to facebook button, but the content that it pulls is not ideal. What is the best way to dynamically set the image and content that is share to facebook.

this is what my facebook button looks like.
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" onclick="return fbs_click()" target="_blank" class="fb_share_link btn btn-default btn-xs"><i class="icon-facebook"></i></a>

User avatar
Kentico MVP
Kentico MVP
Brenden Kehren - 2/4/2014 1:52:18 PM
   
RE:Best way to create a share to facebook button
I use a tool like ShareThis or AddThis. Then in the transformation for repeated content like blog posts I use this:
<span class='st_googleplus_hcount' st_image="<%# Request.Url.Scheme + "://" + Request.Url.Host + BlogFunctions.GetUserAvatar(Eval("DocumentCreatedByUserID")) %>" st_url="<%# Request.Url.Scheme + "://" + Request.Url.Host + GetDocumentUrl() %>" st_title="<%# Eval("BlogPostTitle") %>" displaytext='Google +'></span>
<span class='st_facebook_hcount' st_image="<%#Request.Url.Scheme + "://" + Request.Url.Host + BlogFunctions.GetUserAvatar(Eval("DocumentCreatedByUserID")) %>" st_url="<%# Request.Url.Scheme + "://" + Request.Url.Host + GetDocumentUrl() %>" st_title="<%# Eval("BlogPostTitle") %>" displaytext='Facebook'></span>