mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-05-25 01:03:35 +00:00
Render pages pagination
This commit is contained in:
@@ -13,6 +13,29 @@
|
|||||||
{{ template "menu.go.tmpl" . }}
|
{{ template "menu.go.tmpl" . }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- render top pagination -->
|
||||||
|
{{ if (gt .Pagination.Page 1) }}
|
||||||
|
<div class="pagination-container-top">
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
{{ if (gt .Pagination.Page 1) }}
|
||||||
|
<li>
|
||||||
|
<a href="{{ getBlogURL }}?page={{ sub .Pagination.Page }}">{{ sub .Pagination.Page }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
<li>
|
||||||
|
{{ .Pagination.Page }} ←
|
||||||
|
</li>
|
||||||
|
{{ if (lt .Pagination.Page .Pagination.Total) }}
|
||||||
|
<li>
|
||||||
|
<a href="{{ getBlogURL }}?page={{ add .Pagination.Page }}">{{ add .Pagination.Page }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<!-- render posts -->
|
<!-- render posts -->
|
||||||
<div class="posts-container">
|
<div class="posts-container">
|
||||||
{{ range .Posts }}
|
{{ range .Posts }}
|
||||||
@@ -20,6 +43,29 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- render bottom pagination -->
|
||||||
|
{{ if (gt .Pagination.Total 1) }}
|
||||||
|
<div class="pagination-container-bottom">
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
{{ if (gt .Pagination.Page 1) }}
|
||||||
|
<li>
|
||||||
|
<a href="{{ getBlogURL }}?page={{ sub .Pagination.Page }}">{{ sub .Pagination.Page }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
<li>
|
||||||
|
{{ .Pagination.Page }} ←
|
||||||
|
</li>
|
||||||
|
{{ if (lt .Pagination.Page .Pagination.Total) }}
|
||||||
|
<li>
|
||||||
|
<a href="{{ getBlogURL }}?page={{ add .Pagination.Page }}">{{ add .Pagination.Page }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -4,8 +4,17 @@ import "html/template"
|
|||||||
|
|
||||||
func UseFuncs() template.FuncMap {
|
func UseFuncs() template.FuncMap {
|
||||||
return template.FuncMap{
|
return template.FuncMap{
|
||||||
|
"add": func(i int) int {
|
||||||
|
return i + 1
|
||||||
|
},
|
||||||
|
"sub": func(i int) int {
|
||||||
|
return i - 1
|
||||||
|
},
|
||||||
"getIndexURL": func() string {
|
"getIndexURL": func() string {
|
||||||
return URLIndex
|
return URLIndex
|
||||||
},
|
},
|
||||||
|
"getBlogURL": func() string {
|
||||||
|
return URLBlog
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,20 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- render bottom pagination -->
|
||||||
|
{{ if (gt .Pagination.Total 1) }}
|
||||||
|
<div class="pagination-container-bottom">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
{{ .Pagination.Page }} ←
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ getBlogURL }}?page={{ add .Pagination.Page }}">{{ add .Pagination.Page }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user