Implemented paging
This commit is contained in:
parent
e1efac013b
commit
a76fda6810
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.swp
|
@ -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" . }}
|
||||||
|
|
||||||
|
9
layouts/partials/pagination.html
Normal file
9
layouts/partials/pagination.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<nav class="pagination" role="navigation">
|
||||||
|
{{if .HasPrev}}
|
||||||
|
<a class="newer-posts" href="{{ .Prev.URL }}">« Newer Posts</a>
|
||||||
|
{{end}}
|
||||||
|
<span class="page-number">Page {{ .PageNumber }} of {{.TotalPages}}</span>
|
||||||
|
{{if .HasNext}}
|
||||||
|
<a class="older-posts" href="{{ .Next.URL }}">Older Posts »</a>
|
||||||
|
{{end}}
|
||||||
|
</nav>
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user