summaryrefslogtreecommitdiff
path: root/layouts/_default/section.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/_default/section.html')
-rw-r--r--layouts/_default/section.html9
1 files changed, 4 insertions, 5 deletions
diff --git a/layouts/_default/section.html b/layouts/_default/section.html
index d1ad5401..c051990e 100644
--- a/layouts/_default/section.html
+++ b/layouts/_default/section.html
@@ -2,9 +2,8 @@
<article class="posts">
{{ partial "header.html" . }}
<div id="posts-archive" class="posts-list">
- {{ partial "components/wordCountChart.html" . }}
<!-- Post Archive List -->
- {{ $first := true }} <!-- 在循环外定义一次 $first 变量 -->
+ {{ $remainingMonthsToOpen := 3 }}
{{ range (where site.RegularPages "Type" "eq" "posts").GroupByDate "2006" -}}
<section class="posts-year-archive">
<h1 class="posts-year-title">
@@ -12,8 +11,8 @@
<small class="font-mono">{{ T "archivePage.postCountAnnual" (len .Pages) }}</small>
</h1>
- {{ range .Pages.GroupByDate "January" }} <!-- 这里每个月的循环 -->
- <details class="posts-month-archive"{{ if $first }} open{{ end }}>
+ {{ range .Pages.GroupByDate "January" }}
+ <details class="posts-month-archive"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}>
<summary>
<h2 class="posts-month-title">
{{ .Key }}
@@ -44,7 +43,7 @@
</ul>
</div>
</details>
- {{ $first = false }} <!-- 将 $first 设置为 false 只在第一个月份显示后 -->
+ {{ $remainingMonthsToOpen = sub $remainingMonthsToOpen 1 }}
{{ end }}
</section>
{{ end }}