Files
blog/themes/Ying/layouts/_default/archives.html
T
2024-09-19 23:15:58 +08:00

46 lines
2.4 KiB
HTML

{{ define "main" }}
<div id="pjax-container">
<div class="post-content" style="list-style-type: none;" uk-scrollspy="target: > .link-title,.diy-h3,li; cls: uk-animation-slide-bottom-small; delay: 0">
{{ $currentYear := 0 }}
{{ $currentMonth := 0 }}
{{ range .Site.RegularPages }}
<!-- {{ if and (eq .Type "post") (ne .Params.status "hidden") }} -->
{{ if and (eq .Type "post") }}
{{ $year := .Date.Year }}
{{ $month := .Date.Month }}
{{ if ne $year $currentYear }}
{{ with $currentYear }} {{ if ne $currentYear 0 }} </div> {{ end }} {{ 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 }}
<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 }}"
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"
href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}
{{ if ne $currentMonth 0 }}
</div> <!-- Close last month -->
{{ end }}
{{ if ne $currentYear 0 }}
</div> <!-- Close last year -->
{{ end }}
</div>
</div>
{{ end }}