blob: efafdcac7490fe37d1f643c5b1ddaf18abbbdbcc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
{{ define "main" }}
<header>{{- partial "header.html" . -}}</header>
<content>
{{ $allPosts := where .Site.RegularPages "Type" "eq" "posts" }}
{{ $excludePosts := where $allPosts "Params.categories" "intersect" (slice "1") }}
{{ $postPages := $allPosts | complement $excludePosts }}
{{ if .Site.Params.showPostCount }}
<p id="post-count">共 {{ len $postPages }} 篇文章</p>
{{ end }}
<div class="blog-posts">
{{ if gt (len $postPages) 0 }}
{{ range $postPages.GroupByDate "2006" }}
<details>
<summary>
<p style="display: inline;">{{ .Key }} 年 ({{ len .Pages }})</p>
</summary>
<ul>
{{ range .Pages }}
<li>
<span>
<i>
<time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
{{ .Date.Format (default "2006-01-02" $.Site.Params.dateFormat) }}
</time>
</i>
</span>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
</details>
{{ end }}
{{ else }}
<p>暂无文章</p>
{{ end }}
</div>
</content>
<hr />
{{ end }}
|