Joel Fischer
Joel Fischer

Reputation: 6597

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?

Upvotes: 10

Views: 3106

Answers (3)

Mykel
Mykel

Reputation: 1764

For me, I had set a permalink in my index.html.

Removing the permalink front matter fixed paginator.

Reference: Jekyll Documentation

Upvotes: 0

Jacob Krall
Jacob Krall

Reputation: 28825

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.

Upvotes: 6

Joel Fischer
Joel Fischer

Reputation: 6597

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

Upvotes: 9

Related Questions