add top feature
This commit is contained in:
parent
f077e9e85c
commit
40dfc5036e
3 changed files with 21 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
{{ define "main" }}
|
||||
<div class="container bodycontainer">
|
||||
{{ range .Paginator.Pages }}
|
||||
{{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }}
|
||||
{{ range $paginator.Pages }}
|
||||
{{ partial "row.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
@ -8,18 +9,19 @@
|
|||
|
||||
|
||||
{{ define "pagination" }}
|
||||
{{ if .Paginator.HasPrev }}
|
||||
{{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }}
|
||||
{{ if $paginator.HasPrev }}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{$.Site.BaseURL}}/{{sub .Paginator.PageNumber 1 }}" tabindex="-1">Previous</a>
|
||||
<a class="page-link" href="{{$.Site.BaseURL}}/{{sub $paginator.PageNumber 1 }}" tabindex="-1">Previous</a>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="{{$.Site.BaseURL}}/{{sub .Paginator.PageNumber 1 }}" tabindex="-1">Previous</a>
|
||||
<a class="page-link" href="{{$.Site.BaseURL}}/{{sub $paginator.PageNumber 1 }}" tabindex="-1">Previous</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
||||
{{ $current_num := .Paginator.PageNumber }}
|
||||
{{ range (seq 1 .Paginator.TotalPages) }}
|
||||
{{ $current_num := $paginator.PageNumber }}
|
||||
{{ range (seq 1 $paginator.TotalPages) }}
|
||||
{{ if (eq $current_num .)}}
|
||||
<li class="page-item active"><a class="page-link" href="{{$.Site.BaseURL}}/{{.}}">{{.}}</a></li>
|
||||
{{ else }}
|
||||
|
@ -27,13 +29,13 @@
|
|||
{{ end }}
|
||||
{{end}}
|
||||
|
||||
{{ if .Paginator.HasNext }}
|
||||
{{ if $paginator.HasNext }}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{$.Site.BaseURL}}/{{ add .Paginator.PageNumber 1 }}">Next</a>
|
||||
<a class="page-link" href="{{$.Site.BaseURL}}/{{ add $paginator.PageNumber 1 }}">Next</a>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="{{$.Site.BaseURL}}/{{ add .Paginator.PageNumber 1 }}">Next</a>
|
||||
<a class="page-link" href="{{$.Site.BaseURL}}/{{ add $paginator.PageNumber 1 }}">Next</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
|
@ -7,6 +7,13 @@
|
|||
|
||||
<!-- 正文 -->
|
||||
<div class="col-sm-8">
|
||||
<!-- 置顶标签 -->
|
||||
{{ if gt .Params.top 0}}
|
||||
<div class="top-mark" style="position: absolute; right: 5%;">
|
||||
<i class="fas fa-bookmark" style="color: #e76b4f;"></i>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<!-- 抬头 -->
|
||||
<!-- 头像前面margin2px -->
|
||||
<div style="margin-top: 2px;">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue