This project is read-only.

Facebook comments

Topics: ASP.NET 2.0, Business Logic Layer
Mar 7, 2012 at 5:41 PM

Hello call, I'm trying to add facebook comments to my blog and use that instead of the regular comments.  In any case, I followed the instructions here: and got the code.  Here is a snippet they tell me to put where you want the comments box to appear:

<div class="fb-comments" data-href="" data-num-posts="5" data-width="470"></div>


Obviously mydomain is changed to match my domain that I have.  In any case, where should I put this snippet so that it brings up new comments for each of my posts?  I tried to put it in the post.aspx file but when I go to a different post my comments from another posts show up if that makes sense.


Thanks for your help, I'm pretty new to .net and website development in general.  Thanks. 

Mar 12, 2012 at 8:49 PM

Okay, so I understand why I get the same posts on every page because of this:


So basically I need to have something dynamically create the url in the "data-href" part of the Facebook div.

Is there a way through C# to dynamically create the url to the permalink of the blog post.  For example /blog/post/2012/03/08/Lorem-Ipsum.aspx should be in the data-href part of the fb-comments div class>  


Once again thanks in advance for any help.   I've been looking around and cannot find a way to do this but if I do I'll post the solution here.

Mar 12, 2012 at 9:50 PM
Edited Mar 12, 2012 at 10:54 PM

Have a look at the way disqus comments are handled in your theme's PostView.ascx

If the facebook div is not attached to the post, i.e. in the side bar, then you will need to add a little more code.


I may be the only person in the world not using Facebook, so not able to test the code, but something simple like this might be worth trying if it doesn't like Post.PermaLink

<div class="fb-comments" data-href="<%=Post.AbsoluteLink.ToString() %>" data-num-posts="5" data-width="470"></div>