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

42 lines
1.7 KiB
HTML
Raw Normal View History

2024-07-11 16:41:31 +08:00
{{ define "main" }}
<div id="pjax-container">
{{/* <h1 class="post-title">{{ .Title }}</h1> */}}
<div class="post-content" style="list-style-type: none;">
{{ $currentYear := 0 }}
{{ $currentMonth := 0 }}
{{ range .Site.RegularPages }}
{{ if 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-left-medium; 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-right-medium; 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-right-medium; 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-left-medium; repeat: false"
href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}
{{ if ne $currentMonth 0 }}
</div> {{ end }}
</div>
</div>
{{ end }}