You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.1 KiB
103 lines
3.1 KiB
{% extends 'base.html' %}
|
|
|
|
{% block title %}首页{% endblock %}
|
|
|
|
{% block headerjs %}
|
|
|
|
<style>
|
|
|
|
form {
|
|
position: relative;
|
|
width: 150px;
|
|
margin: 0 auto;
|
|
}
|
|
.d1{
|
|
float: right;
|
|
line-height: 67px;
|
|
}
|
|
.d1 input {
|
|
width: 100px;
|
|
height: 30px;
|
|
border: 2px solid darkred;
|
|
border-radius: 5px;
|
|
outline: none;
|
|
background: white;
|
|
color: #1e242a;
|
|
}
|
|
</style>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
{% block left %}
|
|
<div id="main">
|
|
{% for post in postList %}
|
|
<article class="article article-type-post">
|
|
<div class="article-meta">
|
|
<a class="article-date">
|
|
<time>{{ post.created|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.desc }}
|
|
|
|
|
|
<p class="article-more-link">
|
|
<a href="/post/{{ post.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 t in post.tag.all %}
|
|
|
|
<li class="article-tag-list-item">
|
|
<a class="article-tag-list-link" href="#">{{ t.tname }}</a>
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
</footer>
|
|
</div>
|
|
</article>
|
|
{% endfor %}
|
|
|
|
<nav id="page-nav">
|
|
|
|
{% if postList.has_previous %} <!--判断是否有上一页-->
|
|
<a class="extend prev" rel="next" href="/page/{{ postList.previous_page_number }}">« Prev</a>
|
|
{% endif %}
|
|
|
|
{% for page in pageList %}
|
|
{% if currentNum == 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 %} |