Adding Facebook Link To DotNetBlogEngine

Adding Facebook Link To DotNetBlogEngine

by MGD King November 16, 2010

With the popularity of Facebook reaching new heights everyday, I thought that it would be cool to have a “Share to Facebook” link at the bottom of all of my posts so if anyone ever wanted to share anything they could. I searched on the DotNetBlogEngine discussion boards and couldn’t find much to help me. However, there was one post that pointed me in the right direction, and now I’ve figured out how to add the link to all of my posts! Here’s all you have to do:

In your current theme folder, open the PostView.ascx file, and place the following code into <div class="bookmarks"> section:

<a rel="nofollow" href="http://www.facebook.com/sharer.php?u=<%=Server.UrlEncode(Post.AbsoluteLink.ToString()) %>" target="blank"><img src="<%=VirtualPathUtility.ToAbsolute("~/pics/")%>f_logo.png" alt="Share on Facebook" style="margin-right:3px" />Share on Facebook</a>

If you want to use a logo, just make sure it's named f_logo.png and you place it in your PICS folder. If you do not want to use a logo, remove the <img src="<%=VirtualPathUtility.ToAbsolute("~/pics/")%>f_logo.png" alt="Share on Facebook" style="margin-right:3px" /> line from the above text.

Save the file on your server or hosted platform and then go to your blog’s homepage. Now you will see the link at the bottom of posts that links individual posts to Facebook!

Keywords: , ,

Filed Under: BlogEngine.net

Add comment


  • Comment
  • Preview
Loading

Who Is MGD King?

MGD KingA lot of people ask me what does MGD King mean? Well, it was a nickname given to me because I used to drink large quantities of Miller Genuine Draft. Someone mentioned to me that I was the King of MGD, and so it stuck.

I'm On Twitter!

Note: For Customization and Configuration, CheckOut Recent Tweets Documentation
 
 

Latest Comments

Comment RSS