This project is read-only.

Fixing themes to support Disqus

Topics: Themes
Nov 6, 2012 at 7:29 PM

Very few themes seem to support Disqus comments. Can anyone give me some points on how I can modify AllTuts so that it shows Disqus comment counts?

Nov 6, 2012 at 7:50 PM

You can copy/paste from theme that supports Disqus, like "Standard" for example. Here is snippet from PostView.ascx :

    <% if (BlogEngine.Core.BlogSettings.Instance.ModerationType == BlogEngine.Core.BlogSettings.Moderation.Disqus)
       { %>
    <a rel="nofollow" href="<%=Post.PermaLink %>#disqus_thread"><%=Resources.labels.comments %></a>
       { %>
    <a rel="bookmark" href="<%=Post.PermaLink %>" title="<%=Server.HtmlEncode(Post.Title) %>">Permalink</a> |
    <a rel="nofollow" href="<%=Post.RelativeOrAbsoluteLink %>#comment"><%=Resources.labels.comments %> (<%=Post.ApprovedComments.Count %>)</a>   
    <%} %>

It shows Disqus comments if you set it as your comment provider or regular BE comments if not.

Nov 6, 2012 at 8:42 PM

Is there a theme that supports Disqus and also is a Razor theme like AllTuts that I could copy the working code out of? I can't seem to find one.

Nov 6, 2012 at 10:11 PM

Yes, here is same thing from built-in "Garland-Revisited" theme (PostView.cshtml)

@if (BlogEngine.Core.BlogSettings.Instance.ModerationType == BlogEngine.Core.BlogSettings.Moderation.Disqus)
   <a rel="nofollow" href="@Model.Post.PermaLink#disqus_thread">@Model.Resources.labels.comments</a>
   <a rel="bookmark" href="@Model.Post.PermaLink" title="@Model.Post.Title">Permalink</a> <text>|</text>
   <a rel="nofollow" href="@Model.Post.RelativeOrAbsoluteLink#comment">@Resources.labels.comments

Nov 6, 2012 at 10:32 PM

Ah, I can't get Garland-Revisited to work. I get an error that says 'ASP.themes_razorhost_postview_ascx' does not contain a definition for 'Resources'.

I upgraded my blog earlier today from to following the instructions. The original folder was deleted and the new version of my blog with only my data copied over was uploaded to an empty folder.

Nov 7, 2012 at 2:17 PM

I did some more testing last night. With a default installation Garland-Revisted works. After I copy my app_data in Garland-Revisted gets the above error.

Nov 7, 2012 at 3:12 PM

If that's the case, you can narrow it down to specific item in app_data that breaks it for whatever reason. For example remove all posts from app_data/posts except one and see if it works. If it is, add more until error shows up. When you got post in question, do the same with content - you should be able to identify exactly what is different and causing this error to happen.

Nov 7, 2012 at 7:18 PM

The specific item in app_data that breaks the theme is turning on Disqus. I rechecked, creating a new default installation of BlogEngine.Net, setting the theme to Garland-Revisited and turning on Disqus support results in the theme breaking.

Mar 19, 2014 at 6:24 PM
I have the same issue with Garland Revisited theme. Whenever I turn on Disqus, BE complains with ASP.themes_razorhost_postview_ascx' does not contain a definition for 'Resources' error. How do I fix this? I am using BE 2.8