【发布时间】:2014-02-18 04:43:09
【问题描述】:
我正在使用 jekyll 并尝试使用分页。从我读过的内容来看,分页只能在 html 文件中工作(如for 列表)。所以当我去暗示它时,我只是进入了我的 config.yml 并添加了
pageinate: 5
paginate_path: "Blog/page:num"
在Blog/ 中我添加了index.html,这很简单
---
layout: blogIndex
---
布局blogIndex 包含
<!DOCTYPE HTML>
<html>
<head>
<title>Blog</title>
</head>
<body onload="init();" onresize="setSize();">
{% include header.html %}
<div id="page">
<div id="content" class="{{ page.title }}">
{% for post in paginator.posts %}
<div class="post">
<a class="bTitle" href="{{post.url}}">{{post.title}}</a>
<div class="date">
{{post.date | date: "%B %-d, %Y" }}
</div>
<div class="pContent">
{{post.excerpt}}
</div>
</div>
{% endfor %}
</div>
</div>
{% include footer.html %}
</body>
</html>
当我生成我的网站并转到 /Blog 时,它无法正常工作,当我创建 12 个帖子时没有帖子显示,但是当我用 site 替换 paginator 时,它会列出我所有的帖子(所以它的分页器无法正常工作)。我在这里做错了什么或遗漏了什么?
【问题讨论】:
标签: ruby pagination jekyll