{% extends "fluent_blogs/base_internal.html" %}
{% load i18n fluent_blogs_tags %}
{% comment %}

    This is the central template for archive pages.
    The layout can be customized easily by overwriting the included templates.
    Each archive also has an individual template, they all extend this template.

{% endcomment %}

{% block meta-description %}{% trans "Latest entries" %}{% endblock %}

{% block link %}
    {{ block.super }}
    {% if category %}<link rel="alternate" type="application/rss+xml" title="{% blocktrans with category=category %}RSS Feed for {{ category }}{% endblocktrans %}" href="{% blogurl 'entry_archive_category_rss' category.slug %}" />{% endif %}
    {% if tag %}<link rel="alternate" type="application/rss+xml" title="{% blocktrans with tag=tag %}RSS Feed for {{ tag }}{% endblocktrans %}" href="{% blogurl 'entry_archive_tag_rss' tag.slug %}" />{% endif %}
    {% if author %}<link rel="alternate" type="application/rss+xml" title="{% blocktrans with author_name=author.get_full_name|default:author.username %}RSS Feed for {{ author_name }}{% endblocktrans %}" href="{% blogurl 'entry_archive_author_rss' author.username %}" />{% endif %}
{% endblock %}

{% block title %}
  {% trans "Latest entries" %}
  {% if category %}| {% blocktrans with category=category %}Category {{ category }}{% endblocktrans %}{% endif %}
  {% if tag %}| {% blocktrans with tag=tag %}Tag {{ tag }}{% endblocktrans %}{% endif %}
  {% if author %}| {% blocktrans with author_name=author.get_full_name|default:author.username %}Author {{ author_name }}{% endblocktrans %}{% endif %}
  {% if page_obj and page_obj.number != 1 %} | {% blocktrans with number=page_obj.number %}Page {{ number }}{% endblocktrans %}{% endif %}
{% endblock %}

{% block content %}
  {% block content_title %}
    {% if category %}<h1>{{ category }}</h1>{% endif %}
    {% if tag %}<h1>{% blocktrans with tag=tag %}Tag {{ tag }}{% endblocktrans %}</h1>{% endif %}
    {% if author %}<h1>{% blocktrans with author.get_full_name|default:author.username as author_name %}Entries by {{ author_name }}{% endblocktrans %}</h1>{% endif %}

    {% if category and category.description %}
      <p>{{ category.description|striptags|safe }}</p>
    {% endif %}
  {% endblock %}


  {% block object_list %}
    <div class="blog-archive-wrapper">
      {% for object in object_list %}
        <article id="blog-entry-{{ object.pk }}" class="blog-entry">
          {% include "fluent_blogs/entry_archive/item.html" %}
        </article>
      {% empty %}
        {% include "fluent_blogs/entry_archive/empty.html" %}
      {% endfor %}
    </div>
  {% endblock %}

  {% block pagination %}
    {% if is_paginated %}
      {% include "fluent_blogs/entry_archive/pagination.html" %}
    {% endif %}
  {% endblock %}
{% endblock %}
