blob: 9b2de37709a2091a9e532b3db0eeb51d4d30900e (
plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
{{ define "main" }}
<article class="index">
{{ partial "header.html" . }}
{{ partial "components/postnav.html" . }}
<!-- Latest Posts -->
<section id="latest-posts">
<div class="posts-list">
{{ $firstPost := true }} <!-- 初始化标记 -->
{{ range first 8 (where site.RegularPages "Type" "in" site.Params.mainSections) }}
<div class="posts-item"
style="view-transition-name: post-{{ .File.UniqueID }}">
<header>
<div class="posts-item-meta">
<time>
{{ .Date.Format "Jan 2" }}
</time>
<h3{{ if $firstPost }} style="margin-bottom: 0"{{ end }}>
<a
href="{{ .Permalink }}"
data-umami-event="Click post link from index"
>{{ .Title }}</a>
</h3>
</div>
{{ with .Params.categories }}
<div class="posts-item-category">
<a href="/categories/{{ . }}" style="padding: 0.1rem 0.3rem;">
{{ . }}
</a>
</div>
{{ end }}
</header>
<!-- 如果是第一篇文章,则显示摘要 -->
{{ if $firstPost }}
<div class="markdown-body posts-item-summary"
style="view-transition-name: post-content-{{ .File.UniqueID }}">
{{ .Summary }}
</div>
{{ $firstPost = false }} <!-- 更新为非第一篇 -->
{{ end }}
</div>
{{ end }}
</div>
<a href="/posts" class="index-section-morelink"
data-umami-event="Click more posts link">
{{ T "moreLinks.posts" }}
</a>
</section>
{{ if eq .Site.Language.Lang "zh" }}
<!-- Latest Cards -->
<section id="latest-cards">
<div class="latest-cards-container">
{{- $cards := .Site.GetPage "section" "cards" }} <!-- 获取 "cards" 部分的内容 -->
{{- $paginator := .Paginate $cards.Pages 4 }} <!-- 对该部分内容进行分页 -->
{{- range $paginator.Pages }}
<div class="card"
style="view-transition-name: card-{{ .File.UniqueID }}">
<div class="card-header">
<h3 class="card-title">
<a
href="{{ .Permalink }}"
data-umami-event="Click card link from index"
class="card-title-link">{{ .Title }}</a>
</h3>
{{- if .Params.tags }}
<p class="card-tags markdown-body">
{{- range .Params.tags }}
<a href="{{ "/tags/" | relURL }}{{ . | urlize }}" class="card-tag">#{{ . }}</a>
{{- end }}
</p>
{{- end }}
</div>
<div class="card-content markdown-body">
{{ .Summary }}
</div>
</div>
{{- end }}
</div>
<div style="margin: 1rem 0">
<a href="/cards" class="index-section-morelink"
data-umami-event="Click more cards link">
{{ T "moreLinks.cards" }}
</a>
</div>
</section>
{{ end }}
</article>
{{ partial "footer.html" . }}
{{ end }}
|