Giveaways, Technology, Smartphones, Programming and Internet


Remove links on comment section Blogengine.net

Am getting to much comments on this blog, most of them are not even related to that post or not even something on this blog. That kind of comments are just indented to make a back link from this site to their site, which may increase the search engine rank. So i just decided to remove the link on the comment section.

I edited the CommentView.ascx on the BlogEngine.NET so that the link will be visible only if i logged in as admin, normal visitors will not see the links. If you need to do this.

1. Open the  CommentView.ascx  (Inside your theme folder)

2. Find the below section

Code Snippet
  1. <p class="author">
  2.     <%= Comment.Website != null ? "<a href=\"" + Comment.Website + "\">" + Comment.Author + "</a>" : Comment.Author %>
  3.     <%= AdminLinks %>
  4.   </p>

3. replace that with this

Code Snippet
  1.   <p class="author">
  2.      <% if (Page.User.Identity.IsAuthenticated) { %>
  3.     <%= Comment.Website != null ? "<a href=\"" + Comment.Website + "\">" + Comment.Author + "</a>" : Comment.Author %>
  4.     <%}else{ %>
  5.      <%= Comment.Author %>
  6.     <%} %>
  7.     <%= AdminLinks %>
  8.   </p>

Related Posts

blog comments powered by Disqus