【发布时间】:2017-10-15 14:47:22
【问题描述】:
我遵循了安装 paginate v2 并对集合进行分页的方法,但是对于 paginator 创建的每个页面,我都会获得一个额外的“示例集合”顶级页面链接。
这里是example.md
---
layout: page
title: Example Collection
permalink: /example/
pagination:
enabled: true
---
{% for post in paginator.posts %}
<h1>{{ post.title }}</h1>
{% endfor %}
{% if paginator.total_pages > 1 %}
<ul>
{% if paginator.previous_page %}
<li>
<a href="{{ paginator.previous_page_path | prepend: site.baseurl }}">Newer</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li>
<a href="{{ paginator.next_page_path | prepend: site.baseurl }}">Older</a>
</li>
{% endif %}
</ul>
{% endif %}
这就是我添加到我的 config.yml 的内容
# Collections
collections:
examplecol:
output: true
permalink: /:collection/:path/
# Plugin: Pagination (jekyll-paginate-v2)
pagination:
collection : 'examplecol'
enabled : true
debug : false
per_page : 3
#permalink : "/page/:num/"
title : ":title - Page :num of :max"
limit : 0
sort_field : "date"
sort_reverse : true
现在,如果 _examplecol 文件夹中有超过 3 个文件,我会在标题中获得超过 1 个 example.md 实例作为页面。
如何在包含所有分页页面的标题中仅包含一个示例集合实例?我想我错过了一些愚蠢的东西。
我尝试删除 example.md YAML 中的永久链接条目,但这只是导致 jekyll 处理器无法找到 examplecol/index.html。
【问题讨论】: