Skip to content

Commit

Permalink
Let's paginate
Browse files Browse the repository at this point in the history
  • Loading branch information
jhersh committed Dec 3, 2024
1 parent 49f599e commit d4c98f5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source "https://rubygems.org"

gem 'RedCloth'
gem 'jekyll'
gem 'jekyll-paginate'
gem 'html-proofer'
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (2.0.1)
RedCloth (4.3.4)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
afm (0.2.2)
Expand Down Expand Up @@ -62,6 +61,7 @@ GEM
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-paginate (1.1.0)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-watch (2.2.1)
Expand Down Expand Up @@ -115,9 +115,9 @@ PLATFORMS
arm64-darwin-24

DEPENDENCIES
RedCloth
html-proofer
jekyll
jekyll-paginate

BUNDLED WITH
2.5.23
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ collections:
tags:
output: true
permalink: tags/:path/

plugins:
- jekyll-paginate

paginate: 5

excerpt_separator: "" # Workaround for http://blog.slaks.net/2013-08-09/jekyll-tag-was-never-closed
16 changes: 15 additions & 1 deletion _includes/post_list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ul class="posts">
{% for post in posts %}
{% for post in paginator.posts %}
<p class="date">{{ post.date | date: "%B %-d, %Y" }}</p>
<li class="title"><a href="{{ post.url }}">{{ post.title }}</a></li>
<li class="last">
Expand All @@ -15,3 +15,17 @@
</li>
{% endfor %}
</ul>

<div class="pagination">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path }}" class="previous">
&larr; Previous
</a>
{% endif %}
<span class="page_number ">
[{{ paginator.page }} of {{ paginator.total_pages }}]
</span>
{% if paginator.next_page %}
<a href="{{ paginator.next_page_path }}" class="next">Next &rarr;</a>
{% endif %}
</div>

0 comments on commit d4c98f5

Please sign in to comment.