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

View File

@ -23,11 +23,32 @@ h1, h2, h3, h4, h5, h6 {
font-family: "Open Sans", sans-serif; font-family: "Open Sans", sans-serif;
} }
.button { .button, .pagination-next:disabled, .pagination-previous:disabled {
color: #eeeeec!important; color: #eeeeec!important;
text-decoration: none!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 { a {
color: #729fcf!important; color: #729fcf!important;
text-decoration: underline!important; text-decoration: underline!important;