Skip to content

Commit

Permalink
Pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
hanju-jo committed Oct 6, 2017
1 parent e69d072 commit 0c9b29e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ navigation:
- name: Theme
url: https://github.com/AWEEKJ/jekyll-now

# Pagination
paginate: 5

# Includes an icon in the footer for each username you enter
footer-links:
dribbble:
Expand Down Expand Up @@ -66,6 +69,7 @@ baseurl: ""
#

permalink: /:title/
paginate_path: /page:num/

# The release of Jekyll Now that you're using
version: v1.2.0
Expand All @@ -88,6 +92,7 @@ sass:
plugins:
- jekyll-sitemap # Create a sitemap using the official Jekyll sitemap gem
- jekyll-feed # Create an Atom feed using the official Jekyll feed gem
- jekyll-paginate

# Exclude these files from your production _site
exclude:
Expand Down
32 changes: 28 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ <h2>No post found</h2>
{% endif %}

<div class="posts">
{% for post in site.posts %}
{% for post in paginator.posts %}
<article class="post">

<h1><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
<h1>
{% if post.link %}
<a href="{{ post.link }}">
{% else %}
<a href="{{ site.baseurl }}{{ post.url }}">
{% endif %}
{{ post.title }}
</a>
</h1>

<div class="entry">
{{ post.excerpt }}
Expand All @@ -19,4 +26,21 @@ <h1><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
<a href="{{ site.baseurl }}{{ post.url }}" class="read-more">Read More</a>
</article>
{% endfor %}
</div>
</div>

<div class="pagination">
<span class="pagination-prev">
{% if paginator.previous_page %}
<a href="{{ site.baseurl }}{{ paginator.previous_page_path }}" class="prev">
Previous
</a>
{% endif %}
</span>
<span class="pagination-next">
{% if paginator.next_page %}
<a href="{{ site.baseurl}}{{ paginator.next_page_path }}" class="next">
Next
</a>
{% endif %}
</span>
</div>

0 comments on commit 0c9b29e

Please sign in to comment.