From 61532d4bb7cc12fe689ad2dc9d7aa4349ff57917 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Mon, 25 Dec 2023 12:00:55 -0700 Subject: [PATCH] Use v2 pagination for category-level pages. --- Gemfile | 1 + Gemfile.lock | 3 +++ README.md | 6 +++--- _config.yml | 10 +++++++++- _includes/post-paginator.html | 14 ++++++++++++++ _layouts/home.html | 6 +++--- _layouts/other.html | 6 +++--- _layouts/projects.html | 6 +++--- gemset.nix | 11 +++++++++++ index.html | 4 ++++ other.html | 4 ++++ projects.html | 4 ++++ 12 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 _includes/post-paginator.html diff --git a/Gemfile b/Gemfile index 0c81987..4ea0343 100644 --- a/Gemfile +++ b/Gemfile @@ -10,4 +10,5 @@ group :jekyll_plugins do gem "jekyll-feed", "~> 0.12" gem "jekyll-seo-tag", "~> 2.8" gem "jekyll-sitemap", "~> 1.4" + gem "jekyll-paginate-v2", "~> 3.0" end diff --git a/Gemfile.lock b/Gemfile.lock index 54e102c..f3cc2bb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,6 +34,8 @@ GEM jekyll-feed (0.17.0) jekyll (>= 3.7, < 5.0) jekyll-paginate (1.1.0) + jekyll-paginate-v2 (3.0.0) + jekyll (>= 3.0, < 5.0) jekyll-sass-converter (3.0.0) sass-embedded (~> 1.54) jekyll-seo-tag (2.8.0) @@ -81,6 +83,7 @@ PLATFORMS DEPENDENCIES jekyll (~> 4.3.2) jekyll-feed (~> 0.12) + jekyll-paginate-v2 (~> 3.0) jekyll-seo-tag (~> 2.8) jekyll-sitemap (~> 1.4) lagrange (~> 4.0) diff --git a/README.md b/README.md index b8dffa9..b5c5792 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Jekyll Flake Template This is a template for bootstrapping a [Jekyll](https://jekyllrb.com/)-based -project (version 4.3.2) with the [minima](https://github.com/jekyll/minima) -theme (version 2.5.1). [direnv](https://direnv.net/) can be used to launch a -dev shell upon entering this directory (refer to `.envrc`). Otherwise run via: +project (version 4.3.2) with the [lagrange](https://github.com/LeNPaul/Lagrange) +theme (version 4.0). [direnv](https://direnv.net/) can be used to launch a dev +shell upon entering this directory (refer to `.envrc`). Otherwise run via: ```bash $ nix develop ``` diff --git a/_config.yml b/_config.yml index 231a8bd..392cff9 100644 --- a/_config.yml +++ b/_config.yml @@ -23,13 +23,21 @@ description: My portfolio author: Joshua Potter github_username: jrpotter -# Build settings theme: lagrange plugins: - jekyll-feed + - jekyll-paginate-v2 - jekyll-seo-tag - jekyll-sitemap +pagination: + enabled: true + per_page: 10 + permalink: '/page/:num/' + limit: 0 + sort_field: 'date' + sort_reverse: true + markdown: kramdown highlighter: route permalink: /:title diff --git a/_includes/post-paginator.html b/_includes/post-paginator.html new file mode 100644 index 0000000..88f28ef --- /dev/null +++ b/_includes/post-paginator.html @@ -0,0 +1,14 @@ +{% if paginator.total_pages > 1 %} + +{% endif %} diff --git a/_layouts/home.html b/_layouts/home.html index c98b87c..c44fefb 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -10,8 +10,7 @@ layout: default credit using my referral link.

-{% for post in site.posts %} -{% if post.categories contains "home" %} +{% for post in paginator.posts %}

{{ post.title }} @@ -39,5 +38,6 @@ layout: default

-{% endif %} {% endfor %} + +{% include post-paginator.html %} diff --git a/_layouts/other.html b/_layouts/other.html index 994c353..533ed37 100644 --- a/_layouts/other.html +++ b/_layouts/other.html @@ -2,8 +2,7 @@ layout: default --- -{% for post in site.posts %} -{% if post.categories contains "other" %} +{% for post in paginator.posts %}

{% if post.href %} @@ -35,5 +34,6 @@ layout: default

-{% endif %} {% endfor %} + +{% include post-paginator.html %} diff --git a/_layouts/projects.html b/_layouts/projects.html index e71decf..533ed37 100644 --- a/_layouts/projects.html +++ b/_layouts/projects.html @@ -2,8 +2,7 @@ layout: default --- -{% for post in site.posts %} -{% if post.categories contains "project" %} +{% for post in paginator.posts %}

{% if post.href %} @@ -35,5 +34,6 @@ layout: default

-{% endif %} {% endfor %} + +{% include post-paginator.html %} diff --git a/gemset.nix b/gemset.nix index c8f0b96..aa4816f 100644 --- a/gemset.nix +++ b/gemset.nix @@ -134,6 +134,17 @@ }; version = "1.1.0"; }; + jekyll-paginate-v2 = { + dependencies = ["jekyll"]; + groups = ["jekyll_plugins"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1qzlqhpiqz28624fp0ak76hfy7908w6kpx62v7z43aiwjv0yc6q0"; + type = "gem"; + }; + version = "3.0.0"; + }; jekyll-sass-converter = { dependencies = ["sass-embedded"]; groups = ["default" "jekyll_plugins"]; diff --git a/index.html b/index.html index 32dfdd8..cc8c86b 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,8 @@ --- layout: home title: Home +pagination: + enabled: true + category: home + indexpage: index --- diff --git a/other.html b/other.html index 2150105..d56a3cb 100644 --- a/other.html +++ b/other.html @@ -1,4 +1,8 @@ --- layout: other title: Other +pagination: + enabled: true + category: other + indexpage: other --- diff --git a/projects.html b/projects.html index bfa0f72..22a8fef 100644 --- a/projects.html +++ b/projects.html @@ -1,4 +1,8 @@ --- layout: projects title: Projects +pagination: + enabled: true + category: project + indexpage: projects ---