blob: 5c209f1b73c70cdb65d89adaebbde94d5d9b65bc (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ $recent := first 10 $pages.ByDate.Reverse }}
<style>
.recent-list {
list-style: none;
margin: 0;
padding: 0;
}
.recent-list li {
margin-bottom: 8px;
}
.recent-date {
font-family: monospace;
margin-right: 10px;
white-space: nowrap;
}
.recent-title {
word-wrap: break-word;
}
.recent-empty {
text-align: center;
font-style: italic;
}
@media (max-width: 720px) {
.recent-list li {
display: flex;
flex-wrap: wrap;
}
.recent-date {
width: auto;
margin-right: 0.5em;
}
}
.recent-posts {
margin-top: .8rem;
}
.recent-posts h2 {
margin-top: 1rem;
margin-bottom: 1rem;
}
</style>
<div class="recent-posts">
{{ if $recent }}
<ul class="recent-list">
{{ range $recent }}
<div class="recent-item">
<li>
<span class="recent-date">{{ .Date.Format "2006-01-02" }}</span>
<a href="{{ .RelPermalink }}" class="recent-title">{{ .Title }}</a>
</li>
<summary>
{{ .Summary }}
</summary>
</div>
{{ end }}
</ul>
{{ else }}
<div class="recent-empty">暂无文章</div>
{{ end }}
</div>
|