Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll paginator generates no pages

I'm having an issue with pagination in Jekyll. It doesn't seem like the paginator liquid tag is doing anything at all. Whenever i replace my for loop on my main index.html page,

{% for post in site.posts %}

with

{% for post in paginator.posts %}

no posts will appear (they appear properly with the first tag).

My _config.yml file does have the following added to it:

paginate: 1
paginate_path: "page:num"

If I try to use another paginator tag such as {{ paginator.total_posts }}, nothing appears.

I'm trying this by deploying locally, but the final pages go onto github pages. Can anybody tell me why it doesn't seem like the paginator tag is working?

like image 678
Joel Fischer Avatar asked Oct 11 '13 01:10

Joel Fischer


2 Answers

The issue here wasn't with the paginator tag, it was with the paginate tag within the _config.yml file. I had forked this from Jekyll Bootstrap, which has a variable called JB within the _config file. When I added the paginate tag, I added it, but I added it as a sub-variable to JB instead of as a top-level variable. Removing the indentation on the paginate variable fixed this issue

like image 143
Joel Fischer Avatar answered Sep 28 '22 03:09

Joel Fischer


Jekyll 3.0 deprecates pagination, so

gems: [jekyll-paginate]

must be added to _config.yml to get pagination to work again.

However, if you previously added

safe: true

to your _config.yml, like I did, no gems will be loaded–including jekyll-paginate! Removing safe: true and adding gems: [jekyll-paginate] will allow Jekyll 3.0 to perform pagination again.

like image 45
Jacob Krall Avatar answered Sep 28 '22 05:09

Jacob Krall