Use v2 pagination for category-level pages.

main
Joshua Potter 2023-12-25 12:00:55 -07:00
parent 5cd978ef38
commit 61532d4bb7
12 changed files with 62 additions and 13 deletions

View File

@ -10,4 +10,5 @@ group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12" gem "jekyll-feed", "~> 0.12"
gem "jekyll-seo-tag", "~> 2.8" gem "jekyll-seo-tag", "~> 2.8"
gem "jekyll-sitemap", "~> 1.4" gem "jekyll-sitemap", "~> 1.4"
gem "jekyll-paginate-v2", "~> 3.0"
end end

View File

@ -34,6 +34,8 @@ GEM
jekyll-feed (0.17.0) jekyll-feed (0.17.0)
jekyll (>= 3.7, < 5.0) jekyll (>= 3.7, < 5.0)
jekyll-paginate (1.1.0) jekyll-paginate (1.1.0)
jekyll-paginate-v2 (3.0.0)
jekyll (>= 3.0, < 5.0)
jekyll-sass-converter (3.0.0) jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54) sass-embedded (~> 1.54)
jekyll-seo-tag (2.8.0) jekyll-seo-tag (2.8.0)
@ -81,6 +83,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
jekyll (~> 4.3.2) jekyll (~> 4.3.2)
jekyll-feed (~> 0.12) jekyll-feed (~> 0.12)
jekyll-paginate-v2 (~> 3.0)
jekyll-seo-tag (~> 2.8) jekyll-seo-tag (~> 2.8)
jekyll-sitemap (~> 1.4) jekyll-sitemap (~> 1.4)
lagrange (~> 4.0) lagrange (~> 4.0)

View File

@ -1,9 +1,9 @@
# Jekyll Flake Template # Jekyll Flake Template
This is a template for bootstrapping a [Jekyll](https://jekyllrb.com/)-based 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) project (version 4.3.2) with the [lagrange](https://github.com/LeNPaul/Lagrange)
theme (version 2.5.1). [direnv](https://direnv.net/) can be used to launch a theme (version 4.0). [direnv](https://direnv.net/) can be used to launch a dev
dev shell upon entering this directory (refer to `.envrc`). Otherwise run via: shell upon entering this directory (refer to `.envrc`). Otherwise run via:
```bash ```bash
$ nix develop $ nix develop
``` ```

View File

@ -23,13 +23,21 @@ description: My portfolio
author: Joshua Potter author: Joshua Potter
github_username: jrpotter github_username: jrpotter
# Build settings
theme: lagrange theme: lagrange
plugins: plugins:
- jekyll-feed - jekyll-feed
- jekyll-paginate-v2
- jekyll-seo-tag - jekyll-seo-tag
- jekyll-sitemap - jekyll-sitemap
pagination:
enabled: true
per_page: 10
permalink: '/page/:num/'
limit: 0
sort_field: 'date'
sort_reverse: true
markdown: kramdown markdown: kramdown
highlighter: route highlighter: route
permalink: /:title permalink: /:title

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

@ -10,8 +10,7 @@ layout: default
credit using my <a href="https://m.do.co/c/c65b89434c1b" target="_blank">referral link</a>. credit using my <a href="https://m.do.co/c/c65b89434c1b" target="_blank">referral link</a>.
</p> </p>
{% for post in site.posts %} {% for post in paginator.posts %}
{% if post.categories contains "home" %}
<div class="posts-container"> <div class="posts-container">
<h1> <h1>
<a href="{{ post.href }}" target="_blank">{{ post.title }}</a> <a href="{{ post.href }}" target="_blank">{{ post.title }}</a>
@ -39,5 +38,6 @@ layout: default
</span> </span>
</p> </p>
</div> </div>
{% endif %}
{% endfor %} {% endfor %}
{% include post-paginator.html %}

View File

@ -2,8 +2,7 @@
layout: default layout: default
--- ---
{% for post in site.posts %} {% for post in paginator.posts %}
{% if post.categories contains "other" %}
<div class="posts-container"> <div class="posts-container">
<h1> <h1>
{% if post.href %} {% if post.href %}
@ -35,5 +34,6 @@ layout: default
</span> </span>
</p> </p>
</div> </div>
{% endif %}
{% endfor %} {% endfor %}
{% include post-paginator.html %}

View File

@ -2,8 +2,7 @@
layout: default layout: default
--- ---
{% for post in site.posts %} {% for post in paginator.posts %}
{% if post.categories contains "project" %}
<div class="posts-container"> <div class="posts-container">
<h1> <h1>
{% if post.href %} {% if post.href %}
@ -35,5 +34,6 @@ layout: default
</span> </span>
</p> </p>
</div> </div>
{% endif %}
{% endfor %} {% endfor %}
{% include post-paginator.html %}

View File

@ -134,6 +134,17 @@
}; };
version = "1.1.0"; 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 = { jekyll-sass-converter = {
dependencies = ["sass-embedded"]; dependencies = ["sass-embedded"];
groups = ["default" "jekyll_plugins"]; groups = ["default" "jekyll_plugins"];

View File

@ -1,4 +1,8 @@
--- ---
layout: home layout: home
title: Home title: Home
pagination:
enabled: true
category: home
indexpage: index
--- ---

View File

@ -1,4 +1,8 @@
--- ---
layout: other layout: other
title: Other title: Other
pagination:
enabled: true
category: other
indexpage: other
--- ---

View File

@ -1,4 +1,8 @@
--- ---
layout: projects layout: projects
title: Projects title: Projects
pagination:
enabled: true
category: project
indexpage: projects
--- ---