{% extends "base.html" %}
{% load categories i18n static %}

{% block title %}
  {% blocktranslate with name=author.name %}
    Articles by {{ name }}
  {% endblocktranslate %}
{% endblock %}

{% block content %}
<div class="col-sm-4 mb-4 px-3">
  <h1 class="fs-4">{{ author.name }}</h1>
  {% if author.description %}
    <p>{{ author.description|safe }}</p>
  {% endif %}

  {% block tags %}
    {% if tags %}
      {% include "feeds/snippets/tag_author_cloud.html" %}
    {% endif %}
  {% endblock %}

</div>

<div class="col-sm-8 px-3" style="min-height: 60vh;">
  <ul class="list-unstyled mb-4">
  {% for article in page_obj.object_list %}
    <li class="mb-2">
      <div>
        <a rel="external" class="fs-5 text-underline-hover article-link align-middle"
           data-link="{% url "feeds:outbound" %}" data-pk="{{ article.pk }}"
           href="{{ article.url }}">{{ article.title }}</a>
        {% if show_labels %}
          {% for label in article|categories:"label" %}
            <span class="badge ms-2 align-middle label-{{ label.slug }}">{{ label.label|capfirst }}</span>
          {% endfor %}
        {% endif %}
      </div>
      <small class="text-muted">
        {{ article.date|date:"jS M Y" }} -
        <a class="text-underline-hover"
           href="{% url 'feeds:source' article.source.slug %}">{{ article.source.name }}</a>
        {% if article.archive_url %}
          - <a rel="external" class="text-underline-hover article-link"
               data-link="{{ outbound }}" data-pk="{{ article.pk }}"
               href="{{ article.archive_url }}">{% translate "Archived" %}</a>
        {% endif %}
        {% if article.views %}
          - {% blocktranslate count views=article.views %}
              {{ views }} view
            {% plural %}
              {{ views }} views
          {% endblocktranslate %}
        {% endif %}
      </small>
      {% if article.comment %}
        <div class="mt-1 pb-2"><em>{{ article.comment|safe }}</em></div>
      {% endif %}
    </li>
  {% endfor %}
  </ul>

  {% block pagination %}
    {% include "feeds/snippets/pagination.html" %}
  {% endblock %}

</div>
{% endblock %}
