Skip to content

How to use Jekyll Pagination v2? #2483

Answered by lakshyaelite
lakshyaelite asked this question in Q&A
Discussion options

You must be logged in to vote

ChatGPT and I have successfully found a way to use pagination v2.

Add this to the Gemfile:

gem 'jekyll-paginate-v2'

Add this to the _config.yml:

plugins:
  # Your other plugins
  - jekyll-paginate-v2

whitelist:
  - jekyll-paginate-v2

pagination:
  enabled: true
  per_page: 5
  permalink: /page:num/
  title: ':title - page :num'
  sort_field: 'date'
  sort_reverse: true
  indexpage: 'index'
  trail:
    before: 2
    after: 2

Remove/Comment this line in _config.yml:

paginate: 6

Replace _layouts/home.html with this:

---
layout: default
title: Home
permalink: /
pagination:
  enabled: true
---

{% include lang.html %}

{% assign pinned_posts = site.posts | where: "pin", true %}
{% assign n…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lakshyaelite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants