-
Notifications
You must be signed in to change notification settings - Fork 1
/
post.tmpl
126 lines (121 loc) · 5.27 KB
/
post.tmpl
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{{- define "meepo_earth/post" -}}
<!DOCTYPE html>
<html>
<head>
{{ template "meepo_earth/module/libs/import" . }}
{{ template "meepo_earth/module/highlightjs/libs-import" . }}
<script>
main.initColorScheme({{ .settings.color_scheme}},{{ .settings.enable_change_color_scheme }})
</script>
</head>
<body class="bg-slate-50 dark:bg-slate-900">
{{ template "meepo_earth/module/header" . }}
<section class="container mx-auto mt-6 grid grid-cols-4 gap-6">
<div class="z-0 col-span-4 sm:col-span-3">
<div x-data="postUpvote" class="rounded-xl bg-white p-4 dark:bg-slate-800">
<div class="flex items-center justify-between">
<div class="inline-flex items-center justify-start gap-2">
<a href="{{ .blog_url }}" title="{{ .blog_title }}">
<img
src="{{ .user.Avatar }}"
alt="{{ .user.Nickname }}" class="h-10 w-10 rounded-full"
/>
</a>
<div class="flex flex-col gap-0.5">
<a
href="{{ .blog_url }}"
class="text-sm font-semibold text-gray-900 hover:text-gray-600 dark:text-slate-100 dark:hover:text-slate-200"
th:title="{{ .user.Nickname }}"
>{{ .user.Nickname }}</a>
<div class="flex items-center gap-2 text-xs font-light text-gray-600 dark:text-slate-100">
<span> 发布于 {{unix_milli_time_format "2006-01-02" .post.CreateTime}}</span>
<span class="text-gray-300 dark:text-slate-200">/</span>
<span>{{.post.Visits}} 阅读</span>
<span class="text-gray-300 dark:text-slate-200">/</span>
<span>{{.post.CommentCount}} 评论</span>
<span class="text-gray-300 dark:text-slate-200">/</span>
<span data-post-id-likes="{{.post.ID}}">{{.post.Likes}} 点赞</span>
</span>
</div>
</div>
</div>
<div class="inline-flex flex-row gap-1">
<div
@click="handleUpvote({{.post.ID}})"
class="cursor-pointer rounded-lg p-1 hover:bg-gray-100 dark:hover:bg-slate-600"
:class="{'bg-gray-100 dark:bg-slate-600':liked({{.post.ID}})}"
>
<div
class="i-tabler-heart text-lg text-gray-600 hover:text-red-600"
:class="{'text-red-600 dark:text-red-400':liked({{.post.ID}})}"
></div>
</div>
</div>
</div>
<h1 class="my-3 text-2xl font-medium dark:text-slate-50">{{.post.Title}}</h1>
<div class="flex gap-2">
{{ if (gt (len $.post.Tags ) 0) }} <i class="i-tabler-tags"></i> {{ end }}
{{ range $tag := $.post.Tags }}
<a
href="{{ $tag.FullPath }}"
title="{{ $tag.Name }}"
class="cursor-pointer text-sm italic text-gray-600 hover:text-gray-900 dark:text-slate-400 dark:hover:text-slate-500"
>#{{ $tag.Name }}
</a>
{{ end }}
</div>
<article
id="content"
class="prose prose-base mt-4 !max-w-none break-words dark:prose-invert prose-pre:p-0"
>{{ noescape .post.Content }}</article>
<div class="mt-10 flex flex-col sm:flex-row sm:justify-between">
<div class="flex justify-start">
{{ if .prevPost }}
<a
role="navigation"
class="group inline-flex items-center gap-2 truncate text-sm text-gray-600 hover:text-gray-900 dark:text-slate-100 dark:hover:text-slate-200"
href="{{ .prevPost.FullPath }}"
title="{{ .prevPost.Title }}"
>
<span class="i-tabler-chevron-left translate-x-1 text-lg transition-all group-hover:-translate-x-0"></span>
<span>{{ .prevPost.Title }}</span>
</a>
{{ end }}
</div>
<div class="flex justify-end">
{{ if .nextPost }}
<a
role="navigation"
class="group inline-flex items-center gap-2 truncate text-sm text-gray-600 hover:text-gray-900 dark:text-slate-100 dark:hover:text-slate-200"
href="{{ .nextPost.FullPath }}"
title="{{ .nextPost.Title }}"
>
<span>{{ .nextPost.Title }}</span>
<span class="i-tabler-chevron-right -translate-x-1 text-lg transition-all group-hover:translate-x-0"></span>
</a>
{{ end }}
</div>
</div>
{{ if not .target.DisallowComment }}
<hr class="my-10 dark:border-slate-700 " />
<div>
<h2 class="mb-2 text-base font-medium text-gray-900 dark:text-slate-50">评论</h2>
{{ template "meepo_earth/module/_include/comment" . }}
</div>
{{ end }}
</div>
</div>
{{/* sidebar部分 */}}
<aside class="z-0 col-span-1 hidden h-full flex-col gap-6 sm:flex">
{{ template "meepo_earth/module/_include/catalogue" .}}
{{ template "meepo_earth/module/_include/sidebar-post" . }}
</aside>
</section>
{{ template "meepo_earth/module/footer" . }}
{{ template "meepo_earth/module/highlightjs/scripts" . }}
</body>
<script>
main.generateToc();
</script>
</html>
{{- end -}}