stephenmcd / mezzanine

CMS framework for Django
http://mezzanine.jupo.org
BSD 2-Clause "Simplified" License
4.76k stars 1.65k forks source link

Disqus comment count is wrong #427

Closed flexthink closed 11 years ago

flexthink commented 11 years ago

With Disqus enabled, the comment count at the top of a blog post page shows zero comments even if there have been comments posted.

The comment count on the listing page is correct though

flexthink commented 11 years ago

I was able to fix this one myself with a template customization. It would be nice to see it work out of the box though.

in blog_post_details.html:

Replace the comment count with:

    {% if blog_post.allow_comments %}
        {% if settings.COMMENTS_DISQUS_SHORTNAME %}
        <a href="{{ blog_post.get_absolute_url }}#disqus_thread"
            data-disqus-identifier="{% disqus_id_for blog_post %}">
            {% trans "Comments" %}
        </a>
        {% else %}      
            (<a href="#comments">{% spaceless %}
            {% blocktrans count blog_post.comments_count as comments_count %}1 comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
            {% endspaceless %}</a>)
        {% endif %}
    {% endif %}

Also, add this at the bottom:

{% if settings.COMMENTS_DISQUS_SHORTNAME %}
{% include "generic/includes/disqus_counts.html" %}
{% endif %}
stephenmcd commented 11 years ago

Thanks for working this out. Could you set up a pull request? Would be happy to merge it in.