{% extends "zinnia:zinnia/sitemap.html" %}
{% load i18n zinnia_tags mptt_tags %}

{% block content %}
<h2>{% trans "Sitemap" %}</h2>

<div class="entriesbycategories">
  <h3>{% trans "Entries per categories" %}</h3>
  {% for category in categories %}
  <h4>{{ category }}</h4>
  <ul class="list-group">
    {% for entry in category.entries_published.all %}
    <li class="list-group-item">
      <a href="{{ entry.get_absolute_url }}" title="{{ entry.title }}" rel="bookmark">{{ entry.title }}</a>
      {% with comment_count=entry.comments.count %}
      <span class="badge">
        {{ comment_count }} {% trans "comment" %}{{ comment_count|pluralize }}
      </span>
      {% endwith %}
    </li>
    {% empty %}
    <li class="list-group-item">
      {% trans "No entries yet." %}
    </li>
    {% endfor %}
  </ul>
  {% endfor %}
</div>

<div class="allentries">
  <h3>{% trans "All the entries" %}</h3>
  <ul class="list-group">
    {% for entry in entries %}
    <li class="list-group-item">
      <a href="{{ entry.get_absolute_url }}" title="{{ entry.title }}" rel="bookmark">{{ entry.title }}</a>
      - {{ entry.creation_date|date:"SHORT_DATE_FORMAT" }}
      {% with comment_count=entry.comments.count %}
      <span class="badge">
        {{ comment_count }} {% trans "comment" %}{{ comment_count|pluralize }}
      </span>
      {% endwith %}
    </li>
    {% empty %}
    <li class="list-group-item">
      {% trans "No entries yet." %}
    </li>
    {% endfor %}
  </ul>
</div>

<div class="categories">
  <h3>{% trans "Categories" %}</h3>
  {% for category, structure in categories|tree_info %}
    {% if structure.new_level %}<ul class="list-group"><li class="list-group-item">{% else %}</li><li class="list-group-item">{% endif %}
      <a href="{{ category.get_absolute_url }}" title="{{ category.title }}">{{ category.title }}</a>
      <span class="badge">{% blocktrans count entry_count=category.entries_published.count %}{{ entry_count }} entry{% plural %}{{ entry_count }} entries{% endblocktrans %}</span>
    {% for level in structure.closed_levels %}</li></ul>{% endfor %}
    {% empty %}
  <ul class="list-group">
    <li class="list-group-item">
      {% trans "No categories yet." %}
    </li>
  </ul>
  {% endfor %}
</div>

<div class="montharchives">
  <h3>{% trans "Monthly archives" %}</h3>
  {% get_archives_entries %}
</div>
{% endblock content %}
