{% extends 'news/base.html' %}
{% load staticfiles seo_tags %}

{% block seo %}
    {% seo post_list.first.category %}
{% endblock seo %}

{% block posts %}
    <div class="blog_left_sidebar">
        {% for post in post_list %}
            <article class="row blog_item">
                <div class="col-md-3">
                    <div class="blog_info text-right">
                        <div class="post_tag">
                            {% for tag in post.tag.all %}
                                <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>{% if not forloop.last %},{% endif %}
                            {% endfor %}
                        </div>
                        <ul class="blog_meta list">
                            {% if post.author %}
                                <li><a href="#">{{ post.author }}<i class="lnr lnr-user"></i></a></li>
                            {% endif %}
                            <li><span>{{ post.published_date|date:"d M, Y" }}
                                <i class="lnr lnr-calendar-full"></i></span></li>
                            <li><span>{{ post.viewed }} Просмотров<i class="lnr lnr-eye"></i></span></li>
                            <li>
                                <span>
                                    {{ post.comments_set.all.count }} Комментариев<i class="lnr lnr-bubble"></i>
                                </span>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="col-md-9">
                    <div class="blog_post">
                        {% if post.image %}
                            <img src="{{ post.image.image.url }}" alt="{{ post.image.captions }}">
                        {% else %}
                            <img src="{% static 'img/blog/main-blog/m-blog-1.jpg' %}" alt="">
                        {% endif %}
                        <div class="blog_details">
                            <a href="{{ post.get_absolute_url }}"><h2>{{ post.title }}</h2></a>
                            <p>{{ post.mini_text|safe }}</p>
                            <a href="{{ post.get_absolute_url }}" class="blog_btn">Читать</a>
                        </div>
                    </div>
                </div>
            </article>
        {% endfor %}
        {% include 'base/includes/pagination.html' %}
    </div>
{% endblock posts %}