Skip to content

Commit 3e5a407

Browse files
google-labs-jules[bot]vjdhama
authored andcommitted
fix: Correct pagination logic in templates
This commit fixes a build failure caused by incorrect pagination logic in the blog templates. The `pagination.html` partial was not being passed the correct paginator object, which resulted in a build error. - Modifies `layouts/blog/list.html` to pass the paginator object to the `pagination.html` partial. - Updates `layouts/partials/pagination.html` to use the passed paginator object.
1 parent fff5ef7 commit 3e5a407

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

layouts/blog/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
</div>
2626
{{ end }}
2727
</div>
28-
{{ partial "pagination.html" . }}
28+
{{ partial "pagination.html" $paginator }}
2929
</div>
3030
{{ end }}

layouts/partials/pagination.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
{{ $paginator := .Paginator }}
21
<!-- Pagination -->
32
<div class="pagination">
4-
{{ if $paginator.HasPrev }}
5-
<a class="pagination-previous" href="{{ $paginator.Prev.URL }}">
3+
{{ if .HasPrev }}
4+
<a class="pagination-previous" href="{{ .Prev.URL }}">
65
<i class="fa fa-chevron-left"></i>
76
Older Posts
87
</a>
98
{{ end }}
10-
{{ if $paginator.HasNext }}
11-
<a class="pagination-next" href="{{ $paginator.Next.URL }}">
9+
{{ if .HasNext }}
10+
<a class="pagination-next" href="{{ .Next.URL }}">
1211
Newer Posts
1312
<i class="fa fa-chevron-right"></i>
1413
</a>

0 commit comments

Comments
 (0)