Jekyll paginate

夙愿已清 提交于 2019-12-23 12:20:44

问题


I am trying to paginate a list of blog posts in jekyll, but cant seem to get it working. Here's my setup I have a blog directory under my root directory which has a index.md. I have used the following code from the jekyll website

<ul>
{% for post in paginator.posts %}
<li><h1><a href="{{ post.url }}">{{ post.title }}</a></h1></li>
{% endfor %}
</ul>

I have the following in my _config.yml

paginate: 10

nothing get's displayed. Any suggestions as to where I am messing up?

Update - Dir structure

$ls
_config.yml _layouts    _site       css     index.html
_includes   _posts

$ cd blog
$ ls
index.md

回答1:


Simple solution: As written in the jekyll docs you have to provide a index.html (even blog.html won't work).

So simply change your blog/index.md to blog/index.html and having paginate_path: "/blog/page:num/" and paginate: 10 set in your _config.yml you are fine.

Cheers...



来源:https://stackoverflow.com/questions/29159078/jekyll-paginate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!