Update archives.html

This commit is contained in:
小赵同学 committed 2024-09-19 23:22:19 +08:00
1 parent 3d8d402dd2
commit e9ba4bb4e2
1 file changed
+12 -4
+12 -4
View File
@@ -4,20 +4,25 @@
{{ $currentYear := 0 }} {{ $currentYear := 0 }}
{{ $currentMonth := 0 }} {{ $currentMonth := 0 }}
{{ range .Site.RegularPages }} {{ range .Site.RegularPages }}
<!-- {{ if and (eq .Type "post") (ne .Params.status "hidden") }} --> {{ if eq .Type "post" }}
{{ if and (eq .Type "post") }}
{{ $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 }} {{ 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"> <div class="link-title a-title" uk-scrollspy="cls: uk-animation-slide-bottom-small; repeat: false">
<span>{{ $year }}</span> <span>{{ $year }}</span>
</div> </div>
{{ $currentYear = $year }} {{ $currentYear = $year }}
{{ $currentMonth = 0 }} {{ $currentMonth = 0 }}
{{ end }} {{ end }}
{{ if ne $month $currentMonth }} {{ 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" <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" data-target="#collapse{{ $year }}{{ printf "%02d" $month }}" aria-expanded="false"
aria-controls="collapse{{ $year }}{{ printf "%02d" $month }}"> aria-controls="collapse{{ $year }}{{ printf "%02d" $month }}">
@@ -27,6 +32,7 @@
uk-scrollspy="cls: uk-animation-slide-bottom-small; repeat: false"> uk-scrollspy="cls: uk-animation-slide-bottom-small; repeat: false">
{{ $currentMonth = $month }} {{ $currentMonth = $month }}
{{ end }} {{ end }}
<li data-date="{{ $year }}{{ printf "%02d" $month }}{{ .Date.Day }}"> <li data-date="{{ $year }}{{ printf "%02d" $month }}{{ .Date.Day }}">
<span class="articles_date_time">{{ .Date.Format "01/02" }}</span> <span class="articles_date_time">{{ .Date.Format "01/02" }}</span>
<a class="a-archives" uk-scrollspy="cls: uk-animation-slide-bottom-small; repeat: false" <a class="a-archives" uk-scrollspy="cls: uk-animation-slide-bottom-small; repeat: false"
@@ -34,9 +40,11 @@
</li> </li>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if ne $currentMonth 0 }} {{ if ne $currentMonth 0 }}
</div> <!-- Close last month --> </div> <!-- Close last month -->
{{ end }} {{ end }}
{{ if ne $currentYear 0 }} {{ if ne $currentYear 0 }}
</div> <!-- Close last year --> </div> <!-- Close last year -->
{{ end }} {{ end }}