Files
blog/themes/Ying/layouts/_default/archives.html
T

52 lines
2.2 KiB
HTML
Raw Normal View History

2024-07-11 16:41:31 +08:00
{{ define "main" }}
<div id="pjax-container">
2026-01-20 20:09:46 +08:00
<div class="post-content" style="list-style-type: none;" uk-scrollspy="target: .link-title; cls: uk-animation-slide-left-small; delay: 50; repeat: true">
2024-07-11 16:41:31 +08:00
{{ $currentYear := 0 }}
{{ $currentMonth := 0 }}
{{ range .Site.RegularPages }}
2024-09-19 23:22:19 +08:00
{{ if eq .Type "post" }}
2024-07-23 20:17:02 +08:00
{{ $year := .Date.Year }}
{{ $month := .Date.Month }}
2024-09-19 23:22:19 +08:00
2024-07-23 20:17:02 +08:00
{{ if ne $year $currentYear }}
2024-09-19 23:22:19 +08:00
{{ if ne $currentYear 0 }}
</div> <!-- Close previous year -->
{{ end }}
2026-01-20 20:09:46 +08:00
<div class="link-title a-title">
2024-07-23 20:17:02 +08:00
<span>{{ $year }}</span>
</div>
{{ $currentYear = $year }}
{{ $currentMonth = 0 }}
{{ end }}
2024-09-19 23:22:19 +08:00
2024-07-23 20:17:02 +08:00
{{ if ne $month $currentMonth }}
2024-09-19 23:22:19 +08:00
{{ if ne $currentMonth 0 }}
</div> <!-- Close previous month -->
{{ end }}
2026-01-20 20:09:46 +08:00
<h3 class="diy-h3" data-toggle="collapse" uk-scrollspy="cls: uk-animation-fade; delay: 100"
2024-07-23 20:17:02 +08:00
data-target="#collapse{{ $year }}{{ printf "%02d" $month }}" aria-expanded="false"
aria-controls="collapse{{ $year }}{{ printf "%02d" $month }}">
2024-09-19 23:38:32 +08:00
2024-07-23 20:17:02 +08:00
{{ $month | printf "%02d" }}月
</h3>
2026-01-20 20:09:46 +08:00
<div class="collapse" id="collapse{{ $year }}{{ printf "%02d" $month }}" uk-scrollspy="target: > li; cls: uk-animation-slide-right-small; delay: 100">
2024-07-23 20:17:02 +08:00
{{ $currentMonth = $month }}
{{ end }}
2024-09-19 23:22:19 +08:00
2024-07-23 20:17:02 +08:00
<li data-date="{{ $year }}{{ printf "%02d" $month }}{{ .Date.Day }}">
<span class="articles_date_time">{{ .Date.Format "01/02" }}</span>
2026-01-20 20:09:46 +08:00
<a class="a-archives" href="{{ .Permalink }}">{{ .Title }}</a>
2024-07-23 20:17:02 +08:00
</li>
{{ end }}
{{ end }}
2024-09-19 23:22:19 +08:00
2024-07-23 20:17:02 +08:00
{{ if ne $currentMonth 0 }}
</div> <!-- Close last month -->
{{ end }}
2024-09-19 23:22:19 +08:00
2024-07-23 20:17:02 +08:00
{{ if ne $currentYear 0 }}
</div> <!-- Close last year -->
{{ end }}
2024-07-11 16:41:31 +08:00
</div>
</div>
2024-07-23 20:17:02 +08:00
{{ end }}