Added pagination
This commit is contained in:
parent
1f249d15c3
commit
c509d28afc
@ -1,5 +1,6 @@
|
|||||||
baseURL = 'https://xavishobbies.org/'
|
baseURL = 'https://xavishobbies.org/'
|
||||||
languageCode = 'en-us'
|
languageCode = 'en-us'
|
||||||
title = 'Xavis Hobbies'
|
title = 'Xavis Hobbies'
|
||||||
|
paginate = 5
|
||||||
|
|
||||||
theme='xavis'
|
theme='xavis'
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $paginator := .Paginate (where .Pages "Params.categories" "intersect" (slice "Top_of_the_Stack")) }}
|
||||||
|
|
||||||
<h3 style="margin-bottom: 0px"> Tots Posts </h3>
|
<h3 style="margin-bottom: 0px"> Tots Posts </h3>
|
||||||
{{ range where .Pages "Params.categories" "intersect" (slice "Top_of_the_Stack") }}
|
{{ range $paginator.Pages }}
|
||||||
|
|
||||||
<div class="tots_post">
|
<div class="tots_post">
|
||||||
<h3 class="entry_heading">{{ .Title }}</h3>
|
<h3 class="entry_heading">{{ .Title }}</h3>
|
||||||
@ -21,4 +22,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ partial "pagination.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
40
xavishobbies/themes/xavis/layouts/partials/pagination.html
Normal file
40
xavishobbies/themes/xavis/layouts/partials/pagination.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{{ $pag := $.Paginator }}
|
||||||
|
{{ if gt $pag.TotalPages 1 }}
|
||||||
|
<ul class="pagination">
|
||||||
|
{{ with $pag.First }}
|
||||||
|
<li class="page-item-nav">
|
||||||
|
<a href="{{ .URL }}" class="page-link" aria-label="First"><span aria-hidden="true">««</span></a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
<li class="page-item-nav{{ if not $pag.HasPrev }} disabled{{ end }}">
|
||||||
|
<a {{ if $pag.HasPrev }}href="{{ $pag.Prev.URL }}"{{ end }} class="page-link" aria-label="Previous"><span aria-hidden="true">«</span></a>
|
||||||
|
</li>
|
||||||
|
{{ $ellipsed := false }}
|
||||||
|
{{ $shouldEllipse := false }}
|
||||||
|
{{ range $pag.Pagers }}
|
||||||
|
{{ $right := sub .TotalPages .PageNumber }}
|
||||||
|
{{ $showNumber := or (le .PageNumber 3) (eq $right 0) }}
|
||||||
|
{{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }}
|
||||||
|
{{ if $showNumber }}
|
||||||
|
{{ $ellipsed = false }}
|
||||||
|
{{ $shouldEllipse = false }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $shouldEllipse = not $ellipsed }}
|
||||||
|
{{ $ellipsed = true }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if $showNumber }}
|
||||||
|
<li class="page-item{{ if eq . $pag }} active{{ end }}"><a class="page-link" href="{{ .URL }}">{{ .PageNumber }}</a></li>
|
||||||
|
{{ else if $shouldEllipse }}
|
||||||
|
<li class="page-item disabled"><span aria-hidden="true"> … </span></li>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
<li class="page-item-nav{{ if not $pag.HasNext }} disabled{{ end }}">
|
||||||
|
<a {{ if $pag.HasNext }}href="{{ $pag.Next.URL }}"{{ end }} class="page-link" aria-label="Next"><span aria-hidden="true">»</span></a>
|
||||||
|
</li>
|
||||||
|
{{ with $pag.Last }}
|
||||||
|
<li class="page-item-nav">
|
||||||
|
<a href="{{ .URL }}" class="page-link" aria-label="Last"><span aria-hidden="true">»»</span></a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{ end }}
|
@ -162,6 +162,25 @@ img.resize{
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagination{
|
||||||
|
font-size:0px;
|
||||||
|
text-align:center;
|
||||||
|
padding:15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-item{
|
||||||
|
font-size:15px;
|
||||||
|
display:inline-block;
|
||||||
|
border:1px solid #470161;
|
||||||
|
padding:3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-item-nav{
|
||||||
|
font-size:15px;
|
||||||
|
display:inline-block;
|
||||||
|
padding:4px;
|
||||||
|
}
|
||||||
|
|
||||||
#ascii_site_heading{
|
#ascii_site_heading{
|
||||||
color: #ff00e5;
|
color: #ff00e5;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user