Skip to content

Commit

Permalink
Implement pagination feature
Browse files Browse the repository at this point in the history
  • Loading branch information
TimOsahenru committed Dec 26, 2024
1 parent a39921d commit 32205be
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ group :jekyll_plugins do
gem "github-pages"
gem "jekyll-remote-theme"
gem "jekyll-feed"
gem "jekyll-paginate"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ DEPENDENCIES
github-pages
jekyll
jekyll-feed
jekyll-paginate
jekyll-remote-theme
jemoji
tzinfo-data
Expand Down
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ plugins:
- jemoji
- jekyll-feed
- jekyll-sitemap
- jekyll-paginate
# - jekyll-seo-tag
# - jekyll-redirect-from
# - jekyll-remote-theme
Expand Down Expand Up @@ -111,3 +112,6 @@ defaults:
# Set to `true` to show excerpts on the homepage.
#
show_excerpts: true

paginate: 5
paginate_path: "/blog/page:num/"
10 changes: 5 additions & 5 deletions _includes/posts.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% if site.paginate %}
<!-- {% if site.paginate %}
{% assign posts = paginator.posts %}
{% else %}
{% assign posts = site.posts %}
{% endif %}
{% endif %} -->

{%- if posts.size > 0 -%}
{%- if page.list_title -%}
Expand All @@ -29,7 +29,7 @@ <h3>
{%- endfor -%}
</div>

{% if site.paginate %}
<!-- {% if site.paginate %}
<div class="pager">
<ul class="pagination">
{%- if paginator.previous_page %}
Expand All @@ -45,6 +45,6 @@ <h3>
{%- endif %}
</ul>
</div>
{%- endif %}
{%- endif %} -->

{%- endif -%}
{%- endif -%}
8 changes: 8 additions & 0 deletions blog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout: default
lang: en
title: Blog
list_title: Posts
---

<div class="posts">{%- include posts.html -%}</div>
11 changes: 0 additions & 11 deletions blog.md

This file was deleted.

0 comments on commit 32205be

Please sign in to comment.