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
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With