I've found this nice jekyll theme: http://www.jacoporabolini.com/emerald/ with good looking pagination. Unfortunately is only good looking when there is a small number of pages. In case of my blog this looks like this: ![enter image description here](https://i.stack.imgur.com/Kg0K2.png)
这并不奇怪,因为代码如下所示:
{% for page in (1..paginator.total_pages) %}
它应该更像这样:
{% for page in (min(1,paginator.page-3)..max(paginator.page+3,paginator.total_pages)) %}
问题是,我不认为有类似的东西min
and max
在 Liquid 甚至算术运算符中,例如+
or -
。我正在搜索文档但找不到min
or max.
我还检查了许多主题,它们提供的只是这种幼稚的分页,根本没有分页以及第一个|当前|下一个类型的分页。任何提示表示赞赏。
我写了一个液体{% include %}
这正是您正在寻找的。Jekyll 分页器链接.
我基于您使用的逻辑(最小/最大),但它也内置了更多的数学知识。它可以使用 CSS 进行自定义,因此它应该能够执行您所描述的操作。我希望它能满足您的需要!如果没有,请在 GitHub 上提交问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)