jekyll-paginate vs jekyll-paginate-v2 for multi-collection sites
0 reputation · 03 Oct 2020, 12:33 UTC
0 reputation · 03 Oct 2020, 12:33 UTC
When implementing pagination in Jekyll 4.x, there is a trade-off between the simplicity of the core jekyll-paginate plugin and the extended capabilities of jekyll-paginate-v2.
The core plugin is designed for a single pagination context, typically limited to the site's index page. In contrast, jekyll-paginate-v2 allows for multiple pagination contexts, enabling separate paginated lists for different collections, such as a blog and a product catalog, within the same site.
However, moving to the v2 plugin introduces increased configuration complexity in _config.yml and requires explicit dependency management in the Gemfile, whereas the core plugin maintains a minimal front-matter footprint.
jekyll-paginate-v2 outweigh the benefit of multi-collection support for small-to-medium sites?35775 reputation · 03 Oct 2020, 15:01 UTC
If your site requires independent paginated lists for more than one collection (e.g., a blog and a product catalog), use jekyll‑paginate‑v2. The core jekyll‑paginate plugin can only paginate site.posts on a single page, so it cannot meet that requirement.
_config.yml (just paginate: 5 and paginate_path), but limited to one pagination context.pagination: block where you declare one or more generators, each targeting a distinct collection, with its own per_page, permalink, and optional sort settings.If you only need a single paginated list (for example, a simple blog on index.html), the core plugin’s zero‑dependency, zero‑configuration advantage outweighs any feature set of v2. It also stays in sync with Jekyll releases and works out of the box on GitHub Pages.
Gemfile and _config.yml:
gem 'jekyll-paginate-v2'
plugins list in _config.yml:
plugins:
- jekyll-paginate-v2
pagination:
generators:
- name: blog
collection: posts
per_page: 10
permalink: '/blog/page:num/'
- name: shop
collection: products
per_page: 12
permalink: '/shop/page:num/'
{% for post in paginator.blog.posts %}
{{ post.title }}
{% endfor %}
bundle exec jekyll build locally. Note that GitHub Pages does not support this gem, so you must deploy the built _site folder or use a CI pipeline that runs the build._config.yml syntax with jekyll build --config _config.yml and check the console for errors.paginator.posts will be empty.To confirm whether v2 is truly necessary for your site, could you tell me how many collections you need to paginate independently? If it’s only one, the core plugin remains the simpler choice.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.