Pagination in index page

This commit is contained in:
Vladimir Hodakov 2018-01-14 04:17:34 +04:00
parent 50ea9476e8
commit c5282d9a89
2 changed files with 43 additions and 21 deletions

View File

@ -1,25 +1,26 @@
{{ define "main" }}
{{ range $index, $page := first 10 (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
<article>
<span class="is-size-3">
<a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a>
{{ if .Params.tags }}
<div class="tags is-pulled-right">
{{ range $i, $t := .Params.tags }}
<span class="tag">
<a href="/tags/{{$t | urlize }}/">#{{ $t }}</a>
{{ $baseurl := .Site.BaseURL }}
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
{{ range $paginator.Pages }}
<article>
<span class="is-size-2"><a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a>
{{ if .Params.tags }}
<div class="tags is-pulled-right">
{{ range $i, $t := .Params.tags }}
<span class="tag"><a href="/tags/{{$t | urlize }}/">#{{ $t }}</a></span>
{{ end }}
</div>
{{ end }}
</span>
{{ partial "aside" . }}
<br>
<p>{{ .Summary }}</p>
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">{{ .Site.Params.i18n_read_more }}</a>
{{ end }}
</div>
{{ end }}
</span>
{{ partial "aside" . }}
<br>
<p>{{ .Summary }}</p>
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">{{ .Site.Params.i18n_read_more }}</a>
<hr>
</article>
{{ end }}
<hr>
</article>
{{ end }}
{{ partial "pagination" . }}
{{ end }}

View File

@ -23,11 +23,32 @@ h1, h2, h3, h4, h5, h6 {
font-family: "Open Sans", sans-serif;
}
.button {
.button, .pagination-next:disabled, .pagination-previous:disabled {
color: #eeeeec!important;
text-decoration: none!important;
}
.pagination-next[disabled], .pagination-previous[disabled] {
border: 1px solid #eeeeec!important;
color: #eeeeec!important;
background-color: #2e3436!important;
text-decoration: none!important;
}
.pagination-next, .pagination-previous, .pagination-link {
border: 1px solid #729fcf!important;
color: #729fcf!important;
text-decoration: none!important;
font-weight: bold;
}
.pagination-link.is-current {
border: 1px solid #eeeeec!important;
color: #eeeeec!important;
background-color: #2e3436!important;
text-decoration: none!important;
}
a {
color: #729fcf!important;
text-decoration: underline!important;