{% extends 'base.html' %}

{% block title %}尚学堂博客{% endblock %}

{% block main %}
    <div id="main">
    {% for post in postlist %}
        <article class="article article-type-post">
            <div class="article-meta">
                <a class="article-date">
                    <time>{{ post.publish_time|date:'Y-m-d H:i:s' }}</time>
                </a>
                <div class="article-category">
                    <a class="article-category-link" href="#" target="_blank">{{ post.category.cname }}</a>
                </div>
            </div>
            <div class="article-inner">
                <header class="article-header">
                    <h1 itemprop="name">
                        <a class="article-title" href="#" target="_blank">{{ post.title }}</a>
                    </h1>
                </header>
                <div class="article-entry" itemprop="articleBody">
                    <h2>前言</h2>
                    <hr>
                    {{ post.des }}
                    <p class="article-more-link">
                        <a href="/post/{{ post.category_id }}" target="_blank">阅读全文</a>
                    </p>
                </div>
                <footer class="article-footer">
                    <a data-url="存放文章的url" class="article-share-link">分享</a>
                    <ul class="article-tag-list">
                        {% for tag in post.tag.all %}
                            <li class="article-tag-list-item">
                                <a class="article-tag-list-link" href="#">{{ tag.tname }}</a>
                            </li>
                        {% endfor %}
                    </ul>
                </footer>
            </div>
        </article>
    {% endfor %}
        <nav id="page-nav">

            {% if postlist.has_previous %}
                <a class="extend prev" rel="prev" href="/page/{{ postlist.previous_page_number }}">Previous</a>
            {% endif %}

            {% for page in page_list %}
                {% if postlist.number == page %}
                    <span class="page-number current">{{ page }}</span>
                {% else %}
                    <a class="page-number" href="/page/{{ page }}">{{ page }}</a>
                {% endif %}
            {% endfor %}

            {% if postlist.has_next %}
                <a class="extend next" rel="next" href="/page/{{ postlist.next_page_number }}">Next »</a>
            {% endif %}

        </nav>
    </div>
{% endblock %}