Pagination with Blog/index.html in Jekyll-3.2.1

151 Views Asked by At

I am having a problem that seems to be somewhat common with using pagination on pages other than index.html in a Jekyll project.

I found this post that seemed to be exactly what I am looking for:

Jekyll Pagination on every page

However, the solution does not work for me. According to the documentation on Jekyll's website, the following code in _config.yml should change the paginator to use /Blog/index.html rather than /index.html:

gems: [jekyll-paginate]
paginate: 2
paginate_path: "/blog/page:num/"

I have rebuilt and restarted my local server, but the paginator still only works on the /index.html and not /Blog/index.html.

Does anyone have an idea what I could be missing here?

1

There are 1 best solutions below

1
On BEST ANSWER

The paginator internal logic is to :

  • (from code comment) "Determine if a page is a possible candidate to be a template page. Page's name must be index.html and exist in any of the directories between the site source and paginate_path."
  • choose the one closest to paginate_path in length.

In your case Blog/index.html is not recognized as existing in /blog/ path, because Blog != blog.

Or you rename your containing folder to blog, or you set paginate_path: "/Blog/page:num/"