work on pagination
This commit is contained in:
parent
34023a2fb3
commit
d12d6e5529
@ -2,7 +2,7 @@
|
||||
{{template "header" .}}
|
||||
{{template "navbar" .}}
|
||||
<div class="container">
|
||||
{{range .Meta.Pager.Items}}
|
||||
{{range .Meta.Pager.PageCurr.Items}}
|
||||
<div>
|
||||
<h1><a href="{{.Path}}">{{.Meta.Title}}</a></h1>
|
||||
<p>
|
||||
@ -12,18 +12,38 @@
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<ul class="pagination">
|
||||
<li class="page-item {{if not .Meta.Pager.PageUrlPrevOk}}disabled{{end}}">
|
||||
<a class="page-link" href="{{.Meta.Pager.PageUrlPrev}}" tabindex="-1">Previous</a>
|
||||
<ul class="pagination justify-content-center">
|
||||
{{if .Meta.Pager.PageCurr.Prev}}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{.Meta.Pager.PageCurr.Prev.File.Path}}" tabindex="-1">Previous</a>
|
||||
</li>
|
||||
{{range $index, $url := .Meta.Pager.PageUrls}}
|
||||
<li class="page-item {{if eq $index $.Meta.Pager.PageUrlIndex}}disabled{{end}}">
|
||||
<a class="page-link" href="{{$url}}">{{$index}}</a>
|
||||
{{else}}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1">Previous</a>
|
||||
</li>
|
||||
{{end}}
|
||||
<li class="page-item {{if not .Meta.Pager.PageUrlNextOk}}disabled{{end}}">
|
||||
<a class="page-link" href="{{.Meta.Pager.PageUrlNext}}">Next</a>
|
||||
|
||||
{{range .Meta.Pager.PagesAll}}
|
||||
{{if eq $.Meta.Pager.PageCurr.Index .Index}}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#">{{.Index}}</a>
|
||||
</li>
|
||||
{{else}}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{.File.Path}}">{{.Index}}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{if .Meta.Pager.PageCurr.Next}}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{.Meta.Pager.PageCurr.Next.File.Path}}" tabindex="-1">Next</a>
|
||||
</li>
|
||||
{{else}}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1">Next</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
{{template "footer" .}}
|
||||
|
@ -106,7 +106,7 @@ func (b *builder) Build(srcDir, dstDir string) {
|
||||
Chain(frontmatter.New()).
|
||||
Chain(markdown.New().MarkdownFlags(markdownFlags)).
|
||||
Chain(collection.New()).
|
||||
Chain(paginate.New("Groups.Blog").Limit(5)).
|
||||
Chain(paginate.New("Groups.Blog").Limit(3)).
|
||||
Chain(index.New(indexMeta)).
|
||||
Chain(tags.New().IndexMeta(tagMeta)).
|
||||
Chain(breadcrumbs.New()).
|
||||
|
Loading…
Reference in New Issue
Block a user