Jekyll-paginate-v2 not work with Jekyll v4

Dependency Error:

Yikes! It looks like you don’t have jekyll-paginate-v2 or one of its dependencies installed. In order to use Jekyll as currently configured, you’ll need to install this gem. If you’ve run Jekyll with bundle exec, ensure that you have included the jekyll-paginate-v2 gem in your Gemfile as well. The full error message from Ruby is: ‘Unable to activate jekyll-paginate-v2-2.0.0, because jekyll-4.0.0 conflicts with jekyll (~> 3.0)’ If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!

Help!:sleepy:

The support has been added but there hasn’t been a release. So edit your Gemfile to:

gem 'jekyll-paginate-v2', github: 'sverrirs/jekyll-paginate-v2'
2 Likes

I do not use gemfile.
Can i install differently?

example: "sudo gem i 'jekyll-paginate-v2', github: 'sverrirs/jekyll-paginate-v2"

To install the gem from GitHub without a Gemfile, you’ll have to manually build the gem from the repository yourselves and install that:

  1. Clone the repository locally and move into the directory:
    git clone https://github.com/sverrirs/jekyll-paginate-v2.git
    cd jekyll-paginate-v2
    
  2. Bump version in lib/jeyll-paginate-v2/version.rb
  3. Build the gem
    gem build jekyll-paginate-v2.gemspec
    
  4. Install the gem you just built:
    gem install jekyll-paginate-v2 --local
    
1 Like

Thank you very much!:+1:

1 Like

Auto pages not working in jekyll 4

Until the plugin is updated, try my fork by adding this to your Gemfile

gem 'jekyll-paginate-v2', github: 'mmistakes/jekyll-paginate-v2', :branch => 'jekyll-v4'

I had roll it back to a working version, then relaxed the Gemspec to allow for Jekyll v4.

Here’s the issue on GitHub if you want to track it:

1 Like

It works, but next post prev post link not working, in next and prev page showing home page, not sjowing any post.

Next/previous links on a post is something different I believe. It’s not part of the paginator object, which is used when you have a “list of posts”… not a single post. Instead of paginator.previous and paginator.next you use page.previous and page.next.

Something like this would go on your single post layout to page between the post before and after the current one:

{% if page.previous or page.next %}
  <nav class="pagination">
    {% if page.previous %}
      <a href="{{ page.previous.url | relative_url }}">Previous</a>
    {% endif %}
    {% if page.next %}
      <a href="{{ page.next.url | relative_url }}">Next</a>
    {% endif %}
  </nav>
{% endif %}

Hey!
I am facing this weird issue with Jekyll-paginate-v2.
The paginator.posts is working locally but when i update the site on github repo. It doesn’t work on both index.html & blog.html (Inside _pages Folder)

Here are the files,

_config.yml

#Pagination Settings
pagination:
  enabled: true # The default document collection to paginate if nothing is specified ('posts' is default)
  debug: false # Set to 'true' to enable pagination debugging. This can be enabled in the site config or only for individual pagination pages
  collection: 'posts'
  permalink: '/page/:num/' # The permalink structure for the paginated pages (this can be any level deep)
  category: 'posts' # Optional, the default category to use, omit or just leave this as 'posts' to get a backwards-compatible behavior (all posts)
  per_page: 3 # How many objects per paginated page, used to be `paginate` (default: 0, means all)
  sort_reverse: true # Optional, sorts the posts in reverse order (omit to default decending or sort_reverse: true)
  sort_field: 'date' # Optional, defines the field that the posts should be sorted on (omit to default to 'date')
  title: 'Blog' # Optional the title format for the paginated pages (supports :title for original page title, :num for pagination page number, :max for total number of pages)
  limit: 0 # Limit how many pagenated pages to create (default: 0, means all)
  tag: '' # Optional, the default tag to use, omit to disable
  # Optional,omit or set both before and after to zero to disable. 
  # Controls how the pagination trail for the paginated pages look like. 
  trail:
    before: 2
    after: 2
  # Optional, the default file extension for generated pages (e.g html, json, xml).
  # Internally this is set to html by default
  extension: html 

plugins:
  - jekyll-sitemap
  - jekyll-paginate-v2
  - jekyll-redirect-from

index.html

---
layout: default
pagination: 
  enabled: true
  collection: posts
---
  	<div class="container">
  		<div class="row">
  			<div class="col-lg-12 mt-4">
  				<div class="row">

  			{% for post in paginator.posts %}
  	  <div class="col-lg-4 my-5 post indexposts">
  	    <img class="post-img img-fluid" title="{{post.title}}" alt="{{post.title}}" src="{{site.url}}/assets/img/posts/{{ post.slug }}/thumbnail.png">
  	    <div class="post-body">
  	      <div class="post-meta">
  	        <a class="post-category tag" href="#">{{post.tags}}</a>
  	        <span class="post-date"><time datetime="{{ post.date | date_to_xmlschema }}" itemprop="datePublished">{{ post.date | date: "%b %-d, %Y" }}</time></span>
  	      </div>
  	      <h3 class="post-title"><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h3>
  	    </div>
  	  </div>
  		{% endfor %}
  	</div>
  	</div>
  	  </div>
  		</div>

Here is the link to my site.

I would really appreciate any help. Thanks in advance :pray::slight_smile: