{% extends "blog/base.html" %}
{% load blog_tags %}

{% block title %}{{ post.title }}{% endblock %}

{% block content %}

  <h1>{{ post.title }}</h1>
  <p class="date">
    Opublikowany {{ post.publish }} przez {{ post.author }}
  </p>
  {{ post.body|markdown }}
  <p>
    <a href="{% url "blog:post_share" post.id %}">
      Udostępnij ten post
    </a>
  </p>
  <h2>Podobne posty </h2>
  {% for post in similar_posts %}
  <p>
    <a href="{{ post.get_absolute_url }}">{{ post.title }}</a>
  </p>
  {% empty %}
     Nie ma jeszcze podobnych postów.
  {% endfor %}

  {% with comments.count as total_comments %}
    <h2>
      {{ total_comments }} komentarzy
    </h2>
  {% endwith %}
  {% for comment in comments %}
    <div class="comment">
      <p class="info">
        Komentarz {{ forloop.counter }} dodany przez {{ comment.name }}
        {{ comment.created }}
      </p>
      {{ comment.body|linebreaks }}
    </div>
  {% empty %}
    <p>Nie ma jeszcze żadnych komentarzy.</p>
  {% endfor %}
  {% include "blog/post/includes/comment_form.html" %}
{% endblock %}