我正在挣扎这几个小时。我有一个带有以下index.html的Jekyll站点
---
layout: default
---
<div class="home">
<div class="post-box">
<h2 class="post-main-description">Programming Languages Notes</h2>
<ul class="post-list">
{% assign sorted_pages = paginator.posts | sort:"title" %}
{% for post in sorted_pages %}
<li>
<h2>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</h2>
</li>
{% endfor %}
<div class="pagination">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path }}" class="previous">Previous</a>
{% else %}
<span class="previous">Previous</span>
{% endif %}
<span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span>
{% if paginator.next_page %}
<a href="{{ paginator.next_page_path }}" class="next">Next</a>
{% else %}
<span class="next ">Next</span>
{% endif %}
</div>
</ul>
</div>
</div>
如果没有分页,网站可以按照标题对网页进行成功排序。
像这样:
001. Variables and Bindings
002. Tail Recursion
003. Fast Track to Functional Paradigm
004. Introduction to Types
005. Implementing One-of-type in Java
006. Records in SML
007. Case Expressions
008. Truth about Lists
009. Functional Paradigm Warm-up
但是当我介绍分页时,它看起来像这样
005. Implementing One-of-type in Java
006. Records in SML
007. Case Expressions
008. Truth about Lists
009. Functional Paradigm Warm-up
First Page >>
001. Variables and Bindings
002. Tail Recursion
003. Fast Track to Functional Paradigm
004. Introduction to Types
Last Page
如何在第一页上获取已排序的帖子?
感谢。