6
6
{{- define "content" -}}
7
7
{{- $params := partial "function/params.html" -}}
8
8
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
9
+ {{- $data := index .Site.Data (printf "projects.%v" .Language) | default .Site.Data.projects -}}
10
+ {{- $toc := .Scratch.Get "toc" -}}
11
+ {{- $hasToc := (gt (len .Fragments.Headings) 0) | or (gt (len $data) 0) | or (gt .Pages.Len 0) -}}
12
+ {{- $showToc := $toc.enable | and $hasToc -}}
9
13
10
14
{{- /* component-projects.min.css */ -}}
11
15
{{- $options := dict "Source" "css/component-projects/index.scss" "Fingerprint" $fingerprint -}}
12
16
{{- $toCSS := dict "targetPath" "css/component-projects.min.css" "enableSourceMap" true -}}
13
17
{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}}
14
18
{{- partial "plugin/style.html" $options -}}
15
19
20
+ < aside class ="animate__animated animate__fadeIn animate__faster ">
21
+ {{- /* Projects Aside */ -}}
22
+ {{- block "projects-aside" . }}{{ end -}}
23
+ </ aside >
24
+
16
25
< div class ="page archive projects single ">
17
26
< div class ="header ">
18
27
{{- /* Title */ -}}
@@ -25,11 +34,55 @@ <h1 class="single-title animate__animated animate__pulse animate__faster">
25
34
{{- /* Subtitle */ -}}
26
35
{{- with $params.subtitle -}}< p class ="single-subtitle animate__animated animate__fadeIn "> {{ . | $.RenderString }}</ p > {{- end -}}
27
36
</ div >
28
-
37
+
38
+ {{- /* Meta */ -}}
39
+ < div class ="post-meta ">
40
+ {{- /* Projects Meta */ -}}
41
+ {{- block "projects-meta" . }}{{ end -}}
42
+ </ div >
43
+
44
+ {{- /* Featured image */ -}}
45
+ {{- $image := $params.featuredimage -}}
46
+ {{- with .Resources.GetMatch "featured-image" -}}
47
+ {{- $image = .RelPermalink -}}
48
+ {{- end -}}
49
+ {{- with $image -}}
50
+ < div class ="featured-image ">
51
+ {{- dict "Src" . "Title" $.Description | partial "plugin/image.html" -}}
52
+ </ div >
53
+ {{- end -}}
54
+
55
+ {{- /* Static TOC */ -}}
56
+ {{- if $showToc -}}
57
+ {{- $tableOfContents := .Fragments.ToHTML ($toc.startLevel | int) ($toc.endLevel | int) false -}}
58
+ {{- $tocFromData := "" -}}
59
+ {{- range $group := $data -}}
60
+ {{- if $group.title -}}
61
+ {{- $tocFromData = add $tocFromData (printf "< li > < a href =\ "#%v\"> %v</ a > </ li > " ($group.title | anchorize) $group.title) -}}
62
+ {{- end -}}
63
+ {{- end -}}
64
+ {{- $tocFromData = add $tocFromData (printf "< li > < a href =\ "#related-articles\"> %v</ a > </ li > " (T "projects.relatedArticles")) -}}
65
+ {{- with $tocFromData -}}
66
+ {{- if gt (len $.Fragments.Headings) 0 -}}
67
+ {{- $tableOfContents = replaceRE "</ ul > " (printf "%v</ ul > " .) $tableOfContents -}}
68
+ {{- else -}}
69
+ {{- $tableOfContents = replaceRE "</ nav > " (printf "< ul > %v</ ul > </ nav > " .) $tableOfContents -}}
70
+ {{- end -}}
71
+ {{- end -}}
72
+ < div class ="details toc{{ with $params.password }} encrypted-hidden{{ end }} " id ="toc-static " data-kept ="{{ if $toc.keepStatic }}true{{ else }}false{{ end }} ">
73
+ < div class ="details-summary toc-title ">
74
+ < span > {{ T "single.contents" }}</ span >
75
+ < span > {{ dict "Class" "details-icon fa-solid fa-angle-right" | partial "plugin/icon.html" }}</ span >
76
+ </ div >
77
+ < div class ="details-content toc-content " id ="toc-content-static ">
78
+ {{- dict "Content" $tableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
79
+ </ div >
80
+ </ div >
81
+ {{- end -}}
82
+
29
83
{{- /* Content */ -}}
30
84
< div class ="content " id ="content ">
31
85
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
32
- {{- $data := index .Site.Data (printf "projects.%v" .Language) | default .Site.Data.projects -}}
33
86
{{- $headers := dict "headers" (.Scratch.Get "githubTokenHeader") -}}
34
87
{{- $githubLangColors := partial "function/get-remote-json" (dict "URL" "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json" "OPTIONS" $headers ) -}}
35
88
{{- range $group := $data -}}
@@ -113,7 +166,24 @@ <h3 class="group-title">
113
166
{{- partial "paginator.html" . -}}
114
167
{{- end -}}
115
168
169
+ {{- /* Footer */ -}}
170
+ < div class ="post-footer " id ="post-footer ">
171
+ {{- /* Projects Footer */ -}}
172
+ {{- block "projects-footer" . }}< div class ="component-projects-powered "> {{ (T "projects.poweredBy") | safeHTML }}</ div > {{ end -}}
173
+ </ div >
174
+
116
175
{{- /* Comment */ -}}
117
176
{{- partial "single/comment.html" . -}}
118
177
</ div >
178
+
179
+ < aside class ="toc " id ="toc-auto " aria-label ="{{ T "single.contents " }}">
180
+ {{- /* Auto TOC */ -}}
181
+ {{- if $showToc -}}
182
+ < h2 class ="toc-title{{ with $params.password }} encrypted-hidden{{ end }} ">
183
+ {{- T "single.contents" -}}
184
+ {{- dict "Class" "toc-icon fa-solid fa-angle-down fa-fw" | partial "plugin/icon.html" -}}
185
+ </ h2 >
186
+ < div class ="toc-content{{ if eq $toc.auto false }} always-active{{ end }}{{ with $params.password }} encrypted-hidden{{ end }} " id ="toc-content-auto "> </ div >
187
+ {{- end -}}
188
+ </ aside >
119
189
{{- end -}}
0 commit comments