Skip to content

Commit

Permalink
paginator
Browse files Browse the repository at this point in the history
  • Loading branch information
sneg55 committed Jun 18, 2019
1 parent f6381b8 commit c40e175
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ gem 'jekyll-redirect-from', group: :jekyll_plugins
gem 'jekyll-youtube', group: :jekyll_plugins
gem 'jekyll-toc', group: :jekyll_plugins
gem 'jekyll-sitemap', group: :jekyll_plugins
gem 'jekyll-paginate-v2', group: :jekyll_plugins
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ GEM
pathutil (~> 0.9)
rouge (>= 1.7, < 4)
safe_yaml (~> 1.0)
jekyll-paginate-v2 (2.1.0)
jekyll (~> 3.0)
jekyll-random (0.0.3)
jekyll (~> 3.3)
jekyll-redirect-from (0.15.0)
Expand Down Expand Up @@ -71,6 +73,7 @@ PLATFORMS

DEPENDENCIES
jekyll
jekyll-paginate-v2
jekyll-random
jekyll-redirect-from
jekyll-sitemap
Expand Down
9 changes: 9 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ toc:
min_level: 1 # default: 1
max_level: 2 # default: 6

pagination:
enabled: true
per_page: 5
permalink: '/page/:num/'
title: ' - page :num'
limit: 0
sort_field: 'date'
sort_reverse: true

# Build settings
markdown: kramdown
# Layout settings
Expand Down
21 changes: 20 additions & 1 deletion blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
layout: blog-list
title: Defi Blog - What is DeFi? Interviews with DeFi projects, analytics, and important news
metadescription: We want to shed some light on how DeFi products build and how the ecosystem evolves over time. Our blog features interviews with DeFi projects, analytics, and important news.
permalink: /blog/
pagination:
enabled: true
category: blog
permalink: /:num/
---

<header>
Expand All @@ -11,7 +16,7 @@ We want to shed some light on how DeFi products build and how the ecosystem evol

<section class="tiles">

{% for post in site.categories.blog %}
{% for post in paginator.posts %}
<article class="style{{ forloop.index | random_number: 0, 10 }}">


Expand All @@ -33,3 +38,17 @@ We want to shed some light on how DeFi products build and how the ecosystem evol
{% endfor %}

</section>
{% if paginator.total_pages > 1 %}
<ul class="pager">
{% if paginator.previous_page %}
<li class="previous">
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&larr; Newer Posts</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Older Posts &rarr;</a>
</li>
{% endif %}
</ul>
{% endif %}

0 comments on commit c40e175

Please sign in to comment.