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

{% block head_title %}{% trans "Blog" %}: {{ blog.title }} :: {{ site.name }}{% endblock %}

{% block extra_head %}
    {% get_authors_for_blog blog as blog_authors %}
    {% post_titles posts 5 as recent_titles %}
    {% with post_count=posts.count %}
    <meta name="robots" content="index, follow" />
    <meta name="description" content="{{ blog.title }} is a blog{% if blog_authors %} by {% for a in blog_authors %}{{ a.name }}{% if not forloop.last %}, {% endif %}{% endfor %}{% endif %} with more than {{ post_count }} posts about Django. Most recent posts: {{ recent_titles }}" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="https://{{ site.domain }}{{ blog.get_absolute_url }}" />
    <meta property="og:title" content="{% trans 'Blog' %}: {{ blog.title }} :: {{ site.name }}" />
    <meta property="og:description" content="{{ blog.title }} is a blog{% if blog_authors %} by {% for a in blog_authors %}{{ a.name }}{% if not forloop.last %}, {% endif %}{% endfor %}{% endif %} with more than {{ post_count }} posts about Django. Most recent posts: {{ recent_titles }}" />
    <link rel="canonical" href="https://{{ site.domain }}{{ blog.get_absolute_url }}"/>
    {% endwith %}
{% endblock %}

{% block breadcrumb_section %}
    <li class="breadcrumb-item">
        <a class="text-success" href="{% url 'planet:blog-list' %}">{% trans 'Blogs' %}</a>
    </li>
{% endblock %}
{% block breadcrumb_detail %}
    <li class="breadcrumb-item active" aria-current="page">{{ blog.title }}</li>
{% endblock %}

{% block content %}
    <h1>{% trans "Blog" %}: {{ blog.title }}</h1>
    <div class="table-responsive px-0">
        <table class="blog details table table-bordered mb-4">
            <tr>
              <th>{% trans 'web' %}</th>
              <td><a class="text-success text-decoration-none" href="{{ blog.url }}" title="{% trans 'Go to the original blog' %}" target="_blank">{{ blog.url }}</a></td>
            </tr>
            <tr>
              <th>{% trans 'Author' %}</th>
              <td>
                {% for author in blog_authors %}
                  <a class="text-success text-decoration-none" href="{{ author.get_absolute_url }}" title="{% trans 'See author profile and his/her blog posts' %}">{{ author.name }}</a>
                {% endfor %}
              </td>
            </tr>
        </table>
    </div>

    <div class="container px-0">
    {% autopaginate posts 10 %}
    {% for post in posts %}
        <div class="post row">
            {% include "planet/posts/details.html" %}
        </div>
    {% endfor %}
    {% paginate %}
    </div>
{% endblock %}

{% block right_column %}
    {% recent_blogs %}
    {{ block.super }}
{% endblock %}
