{% extends 'main/layout.html' %}
{% block title %}Posts — {{ request.user.username }}{% endblock %}
{% block content %}
<main>
<h1>Posts</h1>
<p>
<a href="{% url 'post_create' %}">Create a new post »</a>
</p>
{% if post_list %}
{% if tag_cloud and request.user.show_tags_in_post_list %}
<div class="tag-cloud">
All tags:
{% for tag, url, is_active in tag_cloud %}
<a href="{{ url }}" class="tag {% if is_active %}active{% endif %}">{{ tag }}</a>
{% endfor %}
</div>
{% endif %}
<p>
List of posts:
</p>
<ul>
{% for item in posts_with_tag_urls %}
<li>
<a href="{% url 'post_detail' item.post.slug %}">
{{ item.post.title }}
</a>
{% if item.post.tag_list and request.user.show_tags_in_post_list %}
<small>
— <b>Tags</b>:
{% for tag, url, is_active in item.tag_urls %}
<a href="{{ url }}" class="tag {% if is_active %}active{% endif %}">{{ tag }}</a>
{% if not forloop.last %}, {% endif %}
{% endfor %}
</small>
{% endif %}
<small>
—
<b>Published on</b>:
{% if item.post.is_published %}
<time datetime="{{ item.itempost.published_at|date:'Y-m-d' }}" itemprop="datePublished">
— {{ item.post.published_at|date:'F j, Y' }}
</time>
{% endif %}
{% if not item.post.is_published %}
— DRAFT/SCHEDULED
{% endif %}
</small>
</li>
{% endfor %}
</ul>
{% endif %}
</main>
{% endblock content %}