修复分页bug
This commit is contained in:
1 parent
2bf1a16008
commit
50ec39d831
4 files changed
+39
-37
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
baseURL = "https://52ql.cn"
|
baseURL = "https://52ql.cn"
|
||||||
languageCode = 'zh-cn'
|
languageCode = 'zh-cn'
|
||||||
title = '小赵同学的博客'
|
title = '优世界'
|
||||||
theme = 'Ying'
|
theme = 'Ying'
|
||||||
# 分页展示文章数 每页展示文章的数量
|
# 分页展示文章数 每页展示文章的数量
|
||||||
paginate = 5
|
paginate = 5
|
||||||
@@ -1,42 +1,44 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div id="pjax-container">
|
<div id="pjax-container">
|
||||||
{{/* <h1 class="post-title">{{ .Title }}</h1> */}}
|
|
||||||
<div class="post-content" style="list-style-type: none;">
|
<div class="post-content" style="list-style-type: none;">
|
||||||
{{ $currentYear := 0 }}
|
{{ $currentYear := 0 }}
|
||||||
{{ $currentMonth := 0 }}
|
{{ $currentMonth := 0 }}
|
||||||
{{ range .Site.RegularPages }}
|
{{ range .Site.RegularPages }}
|
||||||
{{ if eq .Type "post" }}
|
{{ if and (eq .Type "post") (ne .Params.status "hidden") }}
|
||||||
{{ $year := .Date.Year }}
|
{{ $year := .Date.Year }}
|
||||||
{{ $month := .Date.Month }}
|
{{ $month := .Date.Month }}
|
||||||
{{ if ne $year $currentYear }}
|
{{ if ne $year $currentYear }}
|
||||||
{{ with $currentYear }} {{ if ne $currentYear 0 }} </div> {{ end }} {{ end }}
|
{{ with $currentYear }} {{ if ne $currentYear 0 }} </div> {{ end }} {{ end }}
|
||||||
<div class="link-title a-title" uk-scrollspy="cls: uk-animation-slide-left-medium; repeat: false">
|
<div class="link-title a-title" uk-scrollspy="cls: uk-animation-slide-left-medium; repeat: false">
|
||||||
<span>{{ $year }}</span>
|
<span>{{ $year }}</span>
|
||||||
|
</div>
|
||||||
|
{{ $currentYear = $year }}
|
||||||
|
{{ $currentMonth = 0 }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if ne $month $currentMonth }}
|
||||||
|
{{ with $currentMonth }} {{ if ne $currentMonth 0 }} </div> {{ end }} {{ end }}
|
||||||
|
<h3 class="diy-h3" uk-scrollspy="cls: uk-animation-slide-right-medium; repeat: false" data-toggle="collapse"
|
||||||
|
data-target="#collapse{{ $year }}{{ printf "%02d" $month }}" aria-expanded="false"
|
||||||
|
aria-controls="collapse{{ $year }}{{ printf "%02d" $month }}">
|
||||||
|
{{ $month | printf "%02d" }}月
|
||||||
|
</h3>
|
||||||
|
<div class="collapse" id="collapse{{ $year }}{{ printf "%02d" $month }}"
|
||||||
|
uk-scrollspy="cls: uk-animation-slide-right-medium; repeat: false">
|
||||||
|
{{ $currentMonth = $month }}
|
||||||
|
{{ end }}
|
||||||
|
<li data-date="{{ $year }}{{ printf "%02d" $month }}{{ .Date.Day }}">
|
||||||
|
<span class="articles_date_time">{{ .Date.Format "01/02" }}</span>
|
||||||
|
<a class="a-archives" uk-scrollspy="cls: uk-animation-slide-left-medium; repeat: false"
|
||||||
|
href="{{ .Permalink }}">{{ .Title }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if ne $currentMonth 0 }}
|
||||||
|
</div> <!-- Close last month -->
|
||||||
|
{{ end }}
|
||||||
|
{{ if ne $currentYear 0 }}
|
||||||
|
</div> <!-- Close last year -->
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ $currentYear = $year }}
|
|
||||||
{{ $currentMonth = 0 }}
|
|
||||||
{{ end }}
|
|
||||||
{{ if ne $month $currentMonth }}
|
|
||||||
{{ with $currentMonth }} {{ if ne $currentMonth 0 }}
|
|
||||||
</div> {{ end }} {{ end }}
|
|
||||||
<h3 class="diy-h3" uk-scrollspy="cls: uk-animation-slide-right-medium; repeat: false" data-toggle="collapse"
|
|
||||||
data-target="#collapse{{ $year }}{{ printf " %02d" $month }}" aria-expanded="false"
|
|
||||||
aria-controls="collapse{{ $year }}{{ printf " %02d" $month }}">
|
|
||||||
{{ $month | printf "%02d" }}月
|
|
||||||
</h3>
|
|
||||||
<div class="collapse" id="collapse{{ $year }}{{ printf " %02d" $month }}"
|
|
||||||
uk-scrollspy="cls: uk-animation-slide-right-medium; repeat: false">
|
|
||||||
{{ $currentMonth = $month }}
|
|
||||||
{{ end }}
|
|
||||||
<li data-date="{{ $year }}{{ printf " %02d" $month }}{{ .Date.Day }}">
|
|
||||||
<span class="articles_date_time">{{ .Date.Format "01/02" }}</span>
|
|
||||||
<a class="a-archives" uk-scrollspy="cls: uk-animation-slide-left-medium; repeat: false"
|
|
||||||
href="{{ .Permalink }}">{{ .Title }}</a>
|
|
||||||
</li>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
{{ if ne $currentMonth 0 }}
|
|
||||||
</div> {{ end }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<div class="recent-posts section">
|
<div class="recent-posts section">
|
||||||
<h2 class="section-header">随笔<i class="ri-quill-pen-line"></i></h2>
|
<h2 class="section-header">随笔<i class="ri-quill-pen-line"></i></h2>
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }}
|
{{ $paginator := .Paginate (where (where .Site.RegularPages "Type" "post") "Params.status" "ne" "hidden") }}
|
||||||
{{ range $paginator.Pages }}
|
{{ range $paginator.Pages }}
|
||||||
<div class="post">
|
<div class="post">
|
||||||
<div class="time">{{ .Date.Format "January 2, 2006" }}</div>
|
<div class="time">{{ .Date.Format "January 2, 2006" }}</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<article>
|
<article>
|
||||||
<div class="post-list section">
|
<div class="post-list section">
|
||||||
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }}
|
{{ $paginator := .Paginate (where (where .Site.RegularPages "Type" "post") "Params.status" "ne" "hidden") }}
|
||||||
{{ range $paginator.Pages }}
|
{{ range $paginator.Pages }}
|
||||||
<div class="post">
|
<div class="post">
|
||||||
<div class="time">{{ .Date.Format "January 2, 2006" }}</div>
|
<div class="time">{{ .Date.Format "January 2, 2006" }}</div>
|
||||||
|
|||||||
Reference in new issue
Block a user