Add paginate-v2.

pull/1/head
Joshua Potter 2023-12-25 12:40:44 -07:00
parent 5551a827b9
commit 31dd6856e9
9 changed files with 54 additions and 39 deletions

View File

@ -3,6 +3,7 @@
source "https://rubygems.org"
gem "jekyll-theme-chirpy", "6.2.3"
gem "jekyll-paginate-v2", "~> 3.0"
group :test do
gem "html-proofer", "5.0.8"

View File

@ -61,6 +61,8 @@ GEM
jekyll-include-cache (0.2.1)
jekyll (>= 3.7, < 5.0)
jekyll-paginate (1.1.0)
jekyll-paginate-v2 (3.0.0)
jekyll (>= 3.0, < 5.0)
jekyll-redirect-from (0.16.0)
jekyll (>= 3.3, < 5.0)
jekyll-sass-converter (3.0.0)
@ -130,7 +132,8 @@ PLATFORMS
DEPENDENCIES
html-proofer (= 5.0.8)
jekyll-paginate-v2 (~> 3.0)
jekyll-theme-chirpy (= 6.2.3)
BUNDLED WITH
2.4.10
2.4.22

View File

@ -3,6 +3,8 @@
# ========================================
theme: jekyll-theme-chirpy
plugins:
- jekyll-paginate-v2
lang: en
@ -10,7 +12,13 @@ timezone: America/New_York
avatar: https://avatars.githubusercontent.com/u/3267697?v=4
paginate: 10
pagination:
enabled: true
per_page: 10
permalink: '/page/:num/'
limit: 0
sort_field: 'date'
sort_reverse: true
# ========================================
# jekyll-seo-tag settings

View File

@ -0,0 +1,14 @@
{% if paginator.total_pages > 1 %}
<ul>
{% if paginator.previous_page %}
<li>
<a href="{{ paginator.previous_page_path | prepend: site.baseurl }}">Newer</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li>
<a href="{{ paginator.next_page_path | prepend: site.baseurl }}">Older</a>
</li>
{% endif %}
</ul>
{% endif %}

View File

@ -4,22 +4,8 @@ layout: default
{% include lang.html %}
{% assign default = site.posts | where_exp: 'item', 'item.categories contains "devlog"' %}
{% assign default_beg = paginator.page | minus: 1 | times: paginator.per_page %}
{% assign default_num = paginator.posts | size %}
{% assign default_end = default_beg | plus: default_num | minus: 1 %}
{% assign posts = '' | split: '' %}
{% if default_num > 0 %}
{% for i in (default_beg..default_end) %}
{% assign posts = posts | push: default[i] %}
{% endfor %}
{% endif %}
<div id="post-list" class="flex-grow-1 px-xl-1">
{% for post in posts %}
{% for post in paginator.posts %}
<article class="card-wrapper card">
<a href="{{ post.url | relative_url }}" class="post-preview row g-0 flex-md-row-reverse">
{% assign card_body_col = '12' %}
@ -91,6 +77,4 @@ layout: default
</div>
<!-- #post-list -->
{% if paginator.total_pages > 1 %}
{% include post-paginator.html %}
{% endif %}
{% include post-paginator.html %}

View File

@ -4,22 +4,8 @@ layout: default
{% include lang.html %}
{% assign default = site.posts | where_exp: 'item', 'item.categories contains "home"' %}
{% assign default_beg = paginator.page | minus: 1 | times: paginator.per_page %}
{% assign default_num = paginator.posts | size %}
{% assign default_end = default_beg | plus: default_num | minus: 1 %}
{% assign posts = '' | split: '' %}
{% if default_num > 0 %}
{% for i in (default_beg..default_end) %}
{% assign posts = posts | push: default[i] %}
{% endfor %}
{% endif %}
<div id="post-list" class="flex-grow-1 px-xl-1">
{% for post in posts %}
{% for post in paginator.posts %}
<article class="card-wrapper card">
<a href="{{ post.url | relative_url }}" class="post-preview row g-0 flex-md-row-reverse">
{% assign card_body_col = '12' %}
@ -91,6 +77,4 @@ layout: default
</div>
<!-- #post-list -->
{% if paginator.total_pages > 1 %}
{% include post-paginator.html %}
{% endif %}
{% include post-paginator.html %}

7
devlog.html Normal file
View File

@ -0,0 +1,7 @@
---
layout: devlog
pagination:
enabled: true
category: devlog
indexpage: devlog
---

View File

@ -249,6 +249,17 @@
};
version = "1.1.0";
};
jekyll-paginate-v2 = {
dependencies = ["jekyll"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1qzlqhpiqz28624fp0ak76hfy7908w6kpx62v7z43aiwjv0yc6q0";
type = "gem";
};
version = "3.0.0";
};
jekyll-redirect-from = {
dependencies = ["jekyll"];
groups = ["default"];

View File

@ -1,4 +1,7 @@
---
layout: home
# Index page
pagination:
enabled: true
category: home
indexpage: index
---