Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll paginate

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
like image 941
K3rn3l5 Avatar asked Dec 05 '22 04:12

K3rn3l5


1 Answers

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...

like image 71
astark Avatar answered Jan 22 '23 15:01

astark