Implemented paging

This commit is contained in:
Mark Pitman 2015-07-08 00:42:24 -07:00
parent e1efac013b
commit a76fda6810
4 changed files with 53 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.swp

View File

@ -1,11 +1,12 @@
{{ partial "header.html" . }} {{ partial "header.html" . }}
<div class="article-list"> <div class="article-list">
{{ range $index, $page := .Site.Pages }} {{ range $index, $page := .Paginator.Pages }}
{{ if ne $index 0 }} {{ if ne $index 0 }}
<hr/> <hr/>
{{ end }} {{ end }}
{{ .Render "li" }} {{ .Render "li" }}
{{ end }} {{ end }}
</div> </div>
{{ partial "pagination.html" .Paginator }}
{{ partial "footer.html" . }} {{ partial "footer.html" . }}

View File

@ -0,0 +1,9 @@
<nav class="pagination" role="navigation">
{{if .HasPrev}}
<a class="newer-posts" href="{{ .Prev.URL }}">&laquo; Newer Posts</a>
{{end}}
<span class="page-number">Page {{ .PageNumber }} of {{.TotalPages}}</span>
{{if .HasNext}}
<a class="older-posts" href="{{ .Next.URL }}">Older Posts &raquo;</a>
{{end}}
</nav>

View File

@ -216,6 +216,47 @@ a.btn-back {
color: rgba(255, 255, 255, 1.0); color: rgba(255, 255, 255, 1.0);
} }
/* Pagination */
.pagination
{
width: 720px;
text-align: center;
}
.older-posts,.newer-posts
{
display: inline!important;
border: 1px solid #ddd;
border-radius: 15px;
text-decoration: none;
transition: border .3s ease;
padding: 5px 14px;
}
.page-number
{
display: inline-block;
min-width: 100px;
padding: 2px 0;
}
.newer-posts
{
float: left;
}
.older-posts
{
float: right;
}
.older-posts:hover,.newer-posts:hover
{
color: #889093;
border-color: #98a0a4;
}
/* Override some of Bootstrap's styles */ /* Override some of Bootstrap's styles */
pre { pre {