mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 22:14:08 +00:00
Add pagination to blog article list
This commit is contained in:
1 parent
b123ee9af4
commit
6613eab8f6
3 files changed
+34
-2
No files matched your search
@@ -2,14 +2,16 @@
|
||||
{{ partial "navbar.html" . }}
|
||||
<div class="container">
|
||||
|
||||
{{ range .Data.Pages }}
|
||||
{{ $paginator := .Paginate .Data.Pages }}
|
||||
{{ range $paginator.Pages }}
|
||||
<div>
|
||||
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
|
||||
<h4>{{ .Date.Format .Site.Params.date_format }}</h4>
|
||||
<p>{{ .Summary }}</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination" . }}
|
||||
|
||||
{{ partial "footer_container.html" . }}
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
|
||||
<nav>
|
||||
<ul class="pager">
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<li><a href="{{ .Site.BaseURL }}{{ .Paginator.Prev.URL }}">« Previous</a></li>
|
||||
{{ end }}
|
||||
{{ if .Paginator.HasNext }}
|
||||
<li><a href="{{ .Site.BaseURL }}{{ .Paginator.Next.URL }}">Next »</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{ partial "header.html" . }}
|
||||
{{ partial "navbar.html" . }}
|
||||
<div class="container">
|
||||
|
||||
{{ $paginator := .Paginate .Data.Pages }}
|
||||
{{ range $paginator.Pages }}
|
||||
<div>
|
||||
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
|
||||
<h4>{{ .Date.Format .Site.Params.date_format }}</h4>
|
||||
<p>{{ .Summary }}</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination" . }}
|
||||
|
||||
{{ partial "footer_container.html" . }}
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
Reference in new issue
Block a user