{% extends "components/base.html" %}
{% block title %}Post{% endblock %}

{% block main_area %}
  <!-- Title -->
  <h1 class="mt-4">{{ post.title }}</h1>
  {% if post.summary %}
    <h5 class="text-muted">{{ post.summary }}</h5>
  {% endif %}
  <!-- Author -->
  <div class="text-muted fst-italic mb-2">{{ post.created_at }}
    <br>
    by.
    {{ post.author | upper }}</div>
  <div>
    {{ post.render_markdown|safe }}
  </div>
  <hr>
  {% if post.tags.exists %}
    <i class="fa-solid fa-tags"></i>
    {% for tag in post.tags.all %}
      <span class="badge bg-primary">{{ tag }}</span>
    {% endfor %}
    <br/>
    <br/>
  {% endif %}
  <a href="{% url 'blog:post_list' %}" class="btn btn-secondary mt-3">List</a>
  {% if request.user == post.author %}
    <a href="{% url 'blog:update_post' post.pk %}" class="btn btn-warning">Edit</a>
  {% endif %}
{% endblock %}