Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll - getting an error when I have Paginate in my project

I'm running 3.1.2 on Windows

When I try to add 'Paginate' to my project, I'm getting an error in cmd

Deprecation: You appear to have pagination turned on, but you haven't included the jekyll-paginate gem. Ensure you have gems: [jekyll-paginate] in your configuration file.

I have jekyll-paginate (1.1.0) and paginate (4.0.0) installed and it's still giving this error.

Here is my _config.yml file:

paginate: 4
paginate_path: '/blog/page:num/'

And my index.html page

{% for post in paginator.posts limit: 4 %}

What should I check, to resolve this?

like image 880
Alex F Avatar asked Feb 25 '16 22:02

Alex F


3 Answers

Jekyll guys have removed Paginate plugin from version 3.x as it did not play nicely with more core features. You can still enable it using any of these three options

  1. In your site source root, make a _plugins directory. Place your plugins here. Any file ending in *.rb inside this directory will be loaded before Jekyll generates your site.
  2. In your _config.yml file, add a new array with the key gems and the values of the gem names of the plugins you’d like to use. An example:

gems: [jekyll-coffeescript, jekyll-watch, jekyll-assets] # This will require each of these gems automatically. Then install your plugins using gem install jekyll-paginate-category jekyll-watch jekyll-assets

  1. Add the relevant plugins to a Bundler group in your Gemfile. An example: group :jekyll_plugins do gem "my-jekyll-plugin" gem "jekyll-paginate-category" end Now you need to install all plugins from your Bundler group by running single command bundle install

You can find more information on jekyll plugins page

like image 147
AntK Avatar answered Nov 12 '22 22:11

AntK


Make sure you have the following in your _config.yml file.

gems: [jekyll-paginate]

like image 43
Alan Avatar answered Nov 12 '22 23:11

Alan


Maybe the issue is that you have 2 versions of Jekyll, one installed through "apt" and another thru "gem". Try to remove the one installed with "apt" (or whatever command you're using) and update the other version using the bundler "bundle update". I have this error I've corrected by removing Jekyll I installed by "apt" command. ** Notes: I'm using Ubuntu.

like image 2
Abderrahim AZAHROU Avatar answered Nov 12 '22 22:11

Abderrahim AZAHROU