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