{% load i18n fluent_blogs_comments_tags %}{# fluent_blogs_comments_tags == django.contrib.comments library, but makes it optional #}
{% with comment_count=object.comments.count %}

  <div id="comments-wrapper">
    {% if comment_count %}
    <h3 class="has-comments-title">{% blocktrans with entry_title=object.title count comment_count=comment_count %}{{ comment_count }} comment to {{ entry_title }}{% plural %}{{ comment_count }} comments to {{ entry_title }}{% endblocktrans %}</h3>

      {% render_comment_list for object %}

      {% if not object.comments_are_open %}
        <p class="comments-closed">{% trans "Comments are closed." %}</p>
      {% endif %}
    {% else %}
      {# no comments yet, invite #}
      {% if object.comments_are_open %}
        <h3 class="no-comments-title">{% trans "Leave a reply" %}</h3>

        {# include the empty list, so the <div> is there for Ajax code #}
        {% render_comment_list for object %}

      {% endif %}
    {% endif %}
  </div>

  {% if object.comments_are_open %}
    <div id="comments-form-wrapper">
      {% render_comment_form for object %}
    </div>
  {% endif %}

{% endwith %}
