Add pagination

This commit is contained in:
Carson Ip
2017-02-19 16:34:50 +01:00
parent c835fdf95e
commit ca2b12b22d
4 changed files with 24 additions and 1 deletions

View File

@@ -12,6 +12,7 @@
{{ partial "li.html" . }} {{ partial "li.html" . }}
{{ end }} {{ end }}
</div></section> </div></section>
{{ partial "pagination.html" . }}
</section> </section>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}
</div> </div>

View File

@@ -3,7 +3,7 @@
<div id="container"> <div id="container">
{{ partial "header.html" . }} {{ partial "header.html" . }}
<section id="main" class="outer"> <section id="main" class="outer">
{{ range .Data.Pages }} {{ range .Paginator.Pages }}
<article class="article article-type-post" itemscope itemprop="blogPost"> <article class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner"> <div class="article-inner">
<!--<%- partial('post/gallery') %>--> <!--<%- partial('post/gallery') %>-->
@@ -57,6 +57,8 @@
</div> </div>
</article> </article>
{{ end }} {{ end }}
{{ partial "pagination.html" . }}
</section> </section>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}
</div> </div>

View File

@@ -0,0 +1,19 @@
{{ $pag := $.Paginator }}
{{ if gt $pag.TotalPages 1 }}
<nav id="page-nav">
{{ if $pag.HasPrev }}
<a href="{{ $pag.Prev.URL }}" rel="prev" class="extend prev">&laquo; Prev</a>
{{ end }}
{{ range $pag.Pagers }}
{{ if eq . $pag }}
<span class="page-number current">{{ $pag.PageNumber }}</span>
{{ else }}
<a href="{{ .URL }}">{{ .PageNumber }}</a>
{{ end }}
{{ end }}
{{ if $pag.HasNext }}
<a href="{{ $pag.Next.URL }}" rel="next" class="extend next">Next &raquo;</a>
{{ end }}
</nav>
{{ end }}

View File

@@ -12,6 +12,7 @@
{{ partial "li.html" . }} {{ partial "li.html" . }}
{{ end }} {{ end }}
</div></section> </div></section>
{{ partial "pagination.html" . }}
</section> </section>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}
</div> </div>