【发布时间】:2016-02-22 21:19:37
【问题描述】:
我刚刚将 Jekyll 更新到 3.0.1,现在我的分页链接坏了。我正在使用代码from the Jekyll documentation 来链接到每个分页页面。
{% for page in (1..paginator.total_pages) %}
{% if page == paginator.page %}
<em>{{ page }}</em>
{% elsif page == 1 %}
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a>
{% else %}
<a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
{% endif %}
{% endfor %}
但是,对于 else 情况,它生成的 URL 不正确。例如,如果我在第 3 页,则到第 4 页的链接是 example.com/page3/page4(不存在)而不是 example.com/page4。
我哪里错了?
【问题讨论】:
标签: pagination jekyll