{% extends "base.html" %}
{% load i18n mezzanine_tags blog_tags %}

{% block meta_title %}
    {% load_settings BLOG_TITLE %}{{ BLOG_TITLE }}
{% endblock %}
{% block meta_description %}
    {% load_settings BLOG_DESCRIPTION %}{{ BLOG_DESCRIPTION }}
{% endblock %}
{% block title %}
    {% load_settings BLOG_TITLE %}{{ BLOG_TITLE }}
{% endblock %}

{% block main %}
{% load_settings BLOG_DESCRIPTION %}
<p id="description">
{% if tag %}
    {% trans "Viewing posts tagged" %} {{ tag }}
{% else %}{% if category %}
    {% trans "Viewing posts for the category" %} {{ category }}
{% else %}{% if year or month %}
    {% trans "Viewing posts from" %} {% if month %}{{ month }}, {% endif %}
    {{ year }}
{% else %}{% if user %}
    {% trans "Viewing posts by" %} 
    {{ user.get_full_name|default:user.username }}
{% else %}
    {{ BLOG_DESCRIPTION }}
{% endif %}{% endif %}{% endif %}{% endif %}
</p>

{% for blog_post in blog_posts.object_list %}
<h2>
    {% editable blog_post.title %}
    <a href="{% url blog_post_detail blog_post.slug %}">{{ blog_post.title }}</a>
    {% endeditable %}
</h2>
<em class="since">
    {% with blog_post.user as author %}
    <a href="{% url blog_post_list_author author %}">
        {{ author.first_name }} {{ author.last_name }}
    </a>
    {% endwith %}
    {% editable blog_post.publish_date %}
    {{ blog_post.publish_date|timesince }} {% trans "ago" %}
    {% endeditable %}
</em>

{% editable blog_post.description %}
{{ blog_post.description|safe }}
{% endeditable %}

<p class="description">
    <a href="{% url blog_post_detail blog_post.slug %}">{% trans "read more" %}</a> 
    / 
    {% if use_disqus %}
    <a href="{% url blog_post_detail blog_post.slug %}#disqus_thread">
        {% trans "Comments" %}
    </a>
    {% else %}
    <a href="{% url blog_post_detail blog_post.slug %}#comments">
        {% blocktrans count blog_post.num_comments as num_comments %}
        1 comment
        {% plural %}
        {{ num_comments }} comments
        {% endblocktrans %}
    </a>
    {% endif %}
</p>
{% endfor %}

{% pagination_for blog_posts %} 

{% if use_disqus %}
{% include "blog/includes/disqus_counts.html" %} 
{% endif %}

{% endblock %}

{% block right_panel %}
{% include "blog/includes/filter_panel.html" %}
{% endblock %}

