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