{% extends "planet/base.html" %}
{% load i18n pagination_tags tagging_tags planet_tags %}

{% block head_title %}{% trans "Feed" %}: {{ feed.title }}{% endblock %}

{% block extra_head %}
    <meta name="title" content="{% trans 'Feed' %}: {{ feed.title }} - {% trans 'Posts in' %} {{ site.name }}" />
    <meta name="description" content="{% trans 'Feed' %} {{ feed.title }} - {% trans 'Posts in' %} {{ site.name }}" />
    <meta name="robots" content="index, follow" />
    <link rel="canonical" href="http://{{ site.domain }}{{ feed.get_absolute_url }}"/>
{% endblock %}

{% block breadcrumb_section %}
    <li><a href="{% url 'planet.views.blogs_list' %}">Blogs</a> <span class="divider">/</span></li>
    <li><a href="{{ feed.blog.get_absolute_url }}">{{ feed.blog.title }}</a> <span class="divider">/</span></li>
    {% if tag %}
        <li>Feed: <a href="{{ feed.get_absolute_url }}">{{ feed.title }}</a> <span class="divider">/</span></li>
    {% endif %}
{% endblock %}
{% block breadcrumb_detail %}
    {% if tag %}
        <li class="active">Tag: {{ tag.name }}</li>
    {% else %}
        <li class="active">Feed: {{ feed.title }}</li>
    {% endif %}
{% endblock %}

{% block content %}
    {% if feed.icon %}
        <img src="{{ feed.icon }}" alt="{% trans 'Feed icon' %}" />
    {% endif %}
    <h1>{% trans "Feed" %}: {{ feed.title }}</h1>
    {% if feed.subtitle %}
        <p>{{ feed.subtitle|striptags }}</p>
    {% endif %}

    {% if not tag %}
    <table class="blog details table table-hover table-bordered">
        <tr>
            <th>{% trans 'Blog' %}</th><td>
            <a href="{{ feed.blog.get_absolute_url }}" class="feed" title="{% trans 'See details and posts for blog' %} {{ feed.blog.title }}">{{ feed.blog.title }}</a></td>
        </tr>
        <tr>
            <th>{% trans 'RSS 2.0 Feed' %}</th><td>
            <a href="{{ feed.url }}" class="feed" title="{% trans 'Subscribe to ' %} {{ feed.title }}">{{ feed.title }}</a></td>
        </tr>
        <tr>
            <th>{% trans 'web' %}</th><td><a href="{{ feed.blog.url }}" title="{% trans 'Go to the original blog' %}">{{ feed.blog.url }}</a></td>
        </tr>
        <tr>
            <th>{% trans 'Last Update' %}</th><td>{{ feed.last_checked|date:"m.d.Y" }}</td>
        </tr>
        <tr>
            <th>{% trans 'Posts' %}</th><td>{{ feed.post_set.count }}</td>
        </tr>
    </table>
    {% endif %}

    {% if tag %}
        <h2>{% trans 'Posts under tag' %}: <strong>{{ tag }}</strong></h2>
    {% endif %}

    {% autopaginate posts 20 %}
    {% for post in posts %}
        <div class="post {% cycle 'even' 'odd' %} clearfix">
            {% post_details post %}
        </div>
    {% endfor %}
    {% paginate %}
{% endblock %}

{% block right_column %}
    {# this is too slow % authors_for_feed feed %#}

    {% if tag %}
        <div>
            {% related_tags_for tag %}
        </div>
        <div>
            {% feeds_about tag %}
        </div>
    {% endif %}

    {% cloud_for_feed feed %}

    {% if tag %}
        <li>
            <a href="{% url 'planet_tag_author_list' tag.name %}" title="{% trans 'See the list of authors talking about this tag' %}">
                {% trans 'People talking about this' %}
            </a>
        </li>
        <li>
            <a href="{% url 'planet_tag_feed_list' tag.name %}" title="{% trans 'See the list of blogs talking about this tag' %}">
                {% trans 'Feeds talking about this' %}
            </a>
        </li>
    {% endif %}
    {% include 'planet/feeds/blocks/syndication_block.html' %}
{% endblock %}
