Update pagination example

This commit is contained in:
张君君 2013-09-26 00:11:06 +08:00
parent d800cdcc31
commit dd6d0b42fe
1 changed files with 17 additions and 37 deletions

View File

@ -182,51 +182,31 @@ page with links to all but the current page.
{% highlight html %} {% highlight html %}
{% raw %} {% raw %}
<div id="post-pagination" class="pagination"> {% if paginator.total_pages > 1 %}
<!-- Pagination: https://gist.github.com/jsw0528/4720584 -->
<div class="pagination">
{% if paginator.previous_page %} {% if paginator.previous_page %}
<p class="previous"> <a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&laquo; Prev</a>
{% if paginator.previous_page == 1 %}
<a href="/">Previous</a>
{% else %} {% else %}
<a href="{{ paginator.previous_page_path }}">Previous</a> <span>&laquo; Prev</span>
{% endif %}
</p>
{% else %}
<p class="previous disabled">
<span>Previous</span>
</p>
{% endif %} {% endif %}
<ul class="pages"> {% for page in (1..paginator.total_pages) %}
<li class="page"> {% if page == paginator.page %}
{% if paginator.page == 1 %} <em>{{ page }}</em>
<span class="current-page">1</span> {% elsif page == 1 %}
<a href="{{ '/index.html' | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a>
{% else %} {% else %}
<a href="/">1</a> <a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
{% endif %} {% endif %}
</li>
{% for count in (2..paginator.total_pages) %}
<li class="page">
{% if count == paginator.page %}
<span class="current-page">{{ count }}</span>
{% else %}
<a href="/page{{ count }}">{{ count }}</a>
{% endif %}
</li>
{% endfor %} {% endfor %}
</ul>
{% if paginator.next_page %} {% if paginator.next_page %}
<p class="next"> <a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next &raquo;</a>
<a href="{{ paginator.next_page_path }}">Next</a>
</p>
{% else %} {% else %}
<p class="next disabled"> <span>Next &raquo;</span>
<span>Next</span>
</p>
{% endif %} {% endif %}
</div> </div>
{% endif %}
{% endraw %} {% endraw %}
{% endhighlight %} {% endhighlight %}