Search code examples
htmlpaginationjekyllgithub-pages

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?


Solution

  • 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