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-seo-tag", "~> 2.8"
gem "jekyll-sitemap", "~> 1.4"
gem "jekyll-paginate-v2", "~> 3.0"
end

View File

@ -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)

View File

@ -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
```

View File

@ -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

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>.
</p>
{% for post in site.posts %}
{% if post.categories contains "home" %}
{% for post in paginator.posts %}
<div class="posts-container">
<h1>
<a href="{{ post.href }}" target="_blank">{{ post.title }}</a>
@ -39,5 +38,6 @@ layout: default
</span>
</p>
</div>
{% endif %}
{% endfor %}
{% include post-paginator.html %}

View File

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

View File

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

View File

@ -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"];

View File

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

View File

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

View File

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