This project is read-only.

DisqusAddCommentsToPages not implimented

Topics: Business Logic Layer
Aug 26, 2010 at 1:58 PM

I just added Disqus to my 1.6.1 site and noticed comments on my pages (not posts) and I don't care for that feature.  I pulled the source for that version (and the latest) and it appears that DisqusAddCommentsToPages isn't implemented. 

To correct this, open page.aspx in you web root folder and change:

<% if ( BlogSettings.Instance.ModerationType == BlogSettings.Moderation.Disqus  )


<% if ( BlogSettings.Instance.ModerationType == BlogSettings.Moderation.Disqus && BlogSettings.Instance.DisqusAddCommentsToPages )

Thanks to for helping to find the place to change the code.


Also in the 1.6.1 upgrade instructions, you need to include Web.sitemap if you have the web source.  That one had me scratching my head for a few hours as to why I couldn't see or access the Comments admin page.

Aug 26, 2010 at 9:41 PM

Also as a step beyond...

1. If you have to code to BlogEngine.Core you should also open Providers/DbBlogProvider.cs and locate the SelectPost method.  Within it you will find a code comment that says Comments followed by a query.  To remove the now unneeded query you your database,   add the following in red:


if ( BlogSettings.Instance.ModerationType != BlogSettings.Moderation.Disqus )
// Comments sqlQuery = "SELECT..." ... post.Comments.Sort();

You can also place the closing brace after the Email Notification code but that is up to you.

2. In the Web Source, open both widgets/RecentPosts/widget.ascx.cs and App_Code/Controls/RecentPosts.cs (depending on which one you are actually using), locate RenderPosts() and also change the comment line to

string comments = null;

if ( BlogSettings.Instance.ModerationType == BlogSettings.Moderation.Disqus )
     comments = string.Format( "<span><a href=\"{0}#disqus_thread\">{1}</a></span>", post.PermaLink, Resources.labels.comments );
     comments = string.Format( "<span>{0}: {1}</span>", Resources.labels.comments, post.ApprovedComments.Count );

Or just set comments to null for Disqus.

3. And finally, depending on you theme, open your PostView.ascx and remove the comment count.

<% if ( BlogEngine.Core.BlogSettings.Instance.ModerationType != BlogEngine.Core.BlogSettings.Moderation.Disqus )  { %> <a href="<%=Post.RelativeLink %>#comment" class="comments"><%=Post.Comments.Count %> <%=Resources.labels.comments %></a> <%} %>