{% extends 'base.html' %}
{% load i18n %}
{% block content %}
<div class="posts-wrapper">
{% for post in object_list %}
<article class="post">
    <h2><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h2>
    {% if post.image %}
        <img src="{{ post.image.url }}" alt="{{ post.title }}" class="post-image" />
    {% endif %}
    {% if post.short_desc %}
    {{ post.short_desc|truncatewords_html:40|safe }}
    {% else %}
    {{ post.article|truncatewords_html:40|safe }}
    {% endif %}
    <p><a href="{{ post.get_absolute_url }}" class="readmore">{% trans "Read more" %}</a></p>
    <p class="more-info">{% trans "Posted on" %} {{post.pub_date|date:"d E Y"}}
        {% if post.categories.exists %}
        {% trans "in categories" %} {% for category in post.categories.all %}<a href="{{post.get_absolute_url}}">{{category.title}}</a>
        {% if not forloop.last %}, {% endif %}
        {% endfor %}{% endif %}</p>

</article>
{% empty %}
<p>{% trans "No posts found." %}</p>
{% endfor %}
</div>
{% endblock %}
