修复置顶文章bug

This commit is contained in:
小赵同学 committed 2024-09-19 23:38:32 +08:00
1 parent 598fd02885
commit 34dad82f75
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -4,7 +4,6 @@
{{ $currentYear := 0 }}
{{ $currentMonth := 0 }}
{{ range .Site.RegularPages }}
<!-- {{ if and (eq .Type "post") (ne .Params.status "hidden") }} -->
{{ if eq .Type "post" }}
{{ $year := .Date.Year }}
{{ $month := .Date.Month }}
@@ -27,6 +26,7 @@
<h3 class="diy-h3" uk-scrollspy="cls: uk-animation-slide-bottom-small; 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 }}"
+3 -3
View File
@@ -4,8 +4,8 @@
<div class="recent-posts section">
<h2 class="section-header">随笔<i class="ri-quill-pen-line"></i></h2>
<div class="posts">
<!-- 使用 ByWeight 来排序 -->
{{ $posts := where (where .Site.RegularPages "Type" "post") "Params.status" "ne" "hidden" | sort "Weight" "asc" }}
<!-- 使用 sort 对文章按 Weight 排序 -->
{{ $posts := sort (where (where .Site.RegularPages "Type" "post") "Params.status" "ne" "hidden") "Weight" }}
{{ $paginator := .Paginate $posts }}
{{ range $paginator.Pages }}
@@ -26,7 +26,7 @@
{{ end }}
</div>
</div>
</article>
</article>
<ul class="pagination">
<li class="page-item page-next">
{{ if $paginator.HasNext }}