Update archives.html

This commit is contained in:
小赵同学 committed 2024-09-19 23:22:19 +08:00
1 parent 09341c7caf
commit c9e1e7aa88
1 file changed
+12 -4
+12 -4
View File
@@ -4,20 +4,25 @@
{{ $currentYear := 0 }}
{{ $currentMonth := 0 }}
{{ range .Site.RegularPages }}
<!-- {{ if and (eq .Type "post") (ne .Params.status "hidden") }} -->
{{ if and (eq .Type "post") }}
{{ if eq .Type "post" }}
{{ $year := .Date.Year }}
{{ $month := .Date.Month }}
{{ if ne $year $currentYear }}
{{ with $currentYear }} {{ if ne $currentYear 0 }} </div> {{ end }} {{ end }}
{{ if ne $currentYear 0 }}
</div> <!-- Close previous year -->
{{ end }}
<div class="link-title a-title" uk-scrollspy="cls: uk-animation-slide-bottom-small; repeat: false">
<span>{{ $year }}</span>
</div>
{{ $currentYear = $year }}
{{ $currentMonth = 0 }}
{{ end }}
{{ if ne $month $currentMonth }}
{{ with $currentMonth }} {{ if ne $currentMonth 0 }} </div> {{ end }} {{ end }}
{{ if ne $currentMonth 0 }}
</div> <!-- Close previous month -->
{{ end }}
<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 }}">
@@ -27,6 +32,7 @@
uk-scrollspy="cls: uk-animation-slide-bottom-small; 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-bottom-small; repeat: false"
@@ -34,9 +40,11 @@
</li>
{{ end }}
{{ end }}
{{ if ne $currentMonth 0 }}
</div> <!-- Close last month -->
{{ end }}
{{ if ne $currentYear 0 }}
</div> <!-- Close last year -->
{{ end }}