Skip to content

Commit 6b9dab6

Browse files
committed
Add pagination
1 parent ef554b2 commit 6b9dab6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

blog/index.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<h1 class="page-heading">Posts</h1>
99

1010
<ul class="post-list">
11-
{% for post in site.posts %}
11+
{% for post in paginator.posts %}
1212
<li>
1313
<span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span>
1414

@@ -19,6 +19,21 @@ <h2>
1919
{% endfor %}
2020
</ul>
2121

22+
<!-- Pagination links -->
23+
<div class="pagination">
24+
{% if paginator.previous_page %}
25+
<a href="{{ paginator.previous_page_path }}" class="previous">Previous</a>
26+
{% else %}
27+
<span class="previous">Previous</span>
28+
{% endif %}
29+
<span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span>
30+
{% if paginator.next_page %}
31+
<a href="{{ paginator.next_page_path }}" class="next">Next</a>
32+
{% else %}
33+
<span class="next ">Next</span>
34+
{% endif %}
35+
</div>
36+
2237
<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | prepend: site.baseurl }}">via RSS</a></p>
2338

2439
</div>

0 commit comments

Comments
 (0)