Browse Source

Added pagination

master
digitalcraftsman 10 years ago
parent
commit
5e0d20d3be
  1. 5
      layouts/index.html
  2. 18
      layouts/partials/pagination.html
  3. 2
      layouts/partials/post-list.html

5
layouts/index.html

@ -12,8 +12,9 @@
{{ partial "profile.html" . }}
<section id="wrapper" class="home">
{{ partial "post-list.html" . }}
{{ partial "footer.html" . }}
{{ partial "post-list.html" . }}
{{ partial "pagination.html" . }}
{{ partial "footer.html" . }}
</section>
{{ partial "js.html" . }}

18
layouts/partials/pagination.html

@ -0,0 +1,18 @@
<nav id="post-nav">
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
{{ if .Paginator.HasPrev }}
<span class="prev">
<a href="{{.Paginator.Prev.URL}}">
<span class="arrow"></span> Newer Posts
</a>
</span>
{{ end }}
{{ if .Paginator.HasNext }}
<span class="next">
<a href="{{.Paginator.Next.URL}}">
Older Posts <span class="arrow"></span>
</a>
</span>
{{ end }}
{{ end }}
</nav>

2
layouts/partials/post-list.html

@ -1,5 +1,5 @@
<ul id="post-list">
{{ range .Data.Pages }}
{{ range .Paginator.Pages }}
<li>
<a href='{{ .Permalink }}'><aside class="dates">{{ .Date.Format "Jan 2" }}</aside></a>
<a href='{{ .Permalink }}'>{{ .Title }} <h2>{{ .Description }}</h2></a>

Loading…
Cancel
Save