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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
{{ define "partials/get-title" }}
{{ $separator := .Site.Params.titleSeparator | default "|" }}
{{ $primarySep := $separator }}
{{ $secondarySep := $separator }}
{{ if reflect.IsSlice $separator }}
{{ $primarySep = index $separator 0 }}
{{ $secondarySep = index $separator 1 | default (index $separator 0) }}
{{ end }}
{{ $title := .Site.Title }}
{{/* Generate prefix */}}
{{ $prefix := "" }}
{{ if .Params.Title }}
{{ $prefix = .Params.Title }}
{{/* Deprecation warning(v1.0.0) starts */}}
{{ $layout := partial "utils/hyphenate" (.Layout | default .Type) }}
{{/* Deprecation warning(v1.0.0) ends */}}
{{ if and (eq .Type "docs") (ne $layout "doc-list") }}
{{ $docTitle := "" }}
{{ $bundles := partial "get-bundles" . }}
{{ range $bundles.Reverse }}
{{ $version := findRE "v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?" (path.Base .Permalink) }}
{{/* Deprecation warning(v1.0.0) starts */}}
{{ $parentLayout := partial "utils/hyphenate" (.Parent.Layout | default .Parent.Type) }}
{{ $layout := partial "utils/hyphenate" (.Layout | default .Type) }}
{{/* Deprecation warning(v1.0.0) ends */}}
{{ if and (eq $parentLayout "doc-list") (ne $layout "doc-list") }}
{{ $docTitle = .Title }}
{{ else if $version }}
{{ $docTitle = .Title }}
{{ end }}
{{ end }}
{{/* Doc title */}}
{{ $version := findRE "v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?" (path.Base .Permalink) }}
{{/* Deprecation warning(v1.0.0) starts */}}
{{ $parentLayout := partial "utils/hyphenate" (.Parent.Layout | default .Parent.Type) }}
{{/* Deprecation warning(v1.0.0) ends */}}
{{ if or (eq $parentLayout "doc-list") $version }}
{{ $prefix = $docTitle }}
{{ else }}
{{ $prefix = print $prefix " " $secondarySep " " $docTitle }}
{{ end }}
{{ end }}
{{ end }}
{{/* Add prefix */}}
{{ with $prefix }}
{{ $title = print . " " $primarySep " " $title }}
{{ end }}
{{ return $title }}
{{ end }}
<title>{{ partial "get-title" . }}</title>
{{- $eurekaCSS := resources.Get "css/eureka.css" | postCSS (dict "config" "./assets/css/postcss.config.js") }}
{{- $eurekaCSS := $eurekaCSS | minify }}
<link rel="stylesheet" href="{{ $eurekaCSS.Permalink }}">
{{- $eurekaJS := resources.Get "js/eureka.js" | minify }}
<script defer src="{{ $eurekaJS.Permalink }}"></script>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload"
href="https://fonts.googleapis.com/css2?family=Lora:wght@400;600;700&family=Noto+Serif+SC:wght@400;600;700&display=swap"
as="style" onload="this.onload=null;this.rel='stylesheet'">
{{- $assets := .Site.Data.assets }}
{{ $highlightjsStyle := .Site.Params.highlight.highlightjs.style | default "solarized-light" }}
<link rel="stylesheet" href="{{ printf $assets.highlightjs.css.url $assets.highlightjs.version $highlightjsStyle }}"
{{ with $assets.highlightjs.css.sri }} integrity="{{ . }}" {{ end }} media="print"
onload="this.media='all';this.onload=null" crossorigin>
<script defer src="{{ printf $assets.highlightjs.js.url $assets.highlightjs.version }}"
{{ with $assets.highlightjs.js.sri }} integrity="{{ . }}" {{ end }} crossorigin></script>
{{ range .Site.Params.highlight.highlightjs.languages }}
<script defer src="{{ printf $assets.highlightjs.languages.url $assets.highlightjs.version . }}"
{{ with $assets.highlightjs.languages.sri }} integrity="{{ . }}" {{ end }} crossorigin></script>
{{ end }}
<script defer src="{{ printf $assets.fontawesome.js.url $assets.fontawesome.version }}"
{{ with $assets.fontawesome.js.sri }} integrity="{{ . }}" {{ end }} crossorigin></script>
{{ define "partials/get-bundles" }}
{{ $currentPage := . }}
{{ $bundles := slice $currentPage }}
{{ if and (ne $currentPage.Kind "taxonomy") (or (ne $currentPage $currentPage.FirstSection) (eq $currentPage.Kind "term")) }}
{{ $currentBundles := partial "get-bundles" $currentPage.Parent }}
{{ $bundles = $bundles | append $currentBundles }}
{{ end }}
{{ return $bundles }}
{{ end }}
{{- $enableMath := false }}
{{- if .Site.Params.math.handler }}
{{- $bundles := partial "get-bundles" . }}
{{- $enableMath = true }}
{{- range $bundles.Reverse }}
{{- if and (ne .Params.math nil) (ne .Params.math "") }}
{{- $enableMath = .Params.math }}
{{- end }}
{{- end }}
{{- end }}
{{ define "partials/camelize" }}
{{ $input := . }}
{{ $regexp := "(-|_)([a-z])" }}
{{ $matches := findRE $regexp $input }}
{{ range $matches }}
{{ $input = $input | replaceRE . (upper .) }}
{{ end }}
{{ $input = $input | replaceRE "(-|_)" "" }}
{{ return $input }}
{{ end }}
{{- if and (eq .Site.Params.math.handler "katex") $enableMath }}
<link rel="stylesheet" href="{{ printf $assets.katex.css.url $assets.katex.version }}"
{{ with $assets.katex.css.sri }} integrity="{{ . }}" {{ end }} media="print"
onload="this.media='all';this.onload=null" crossorigin>
<script defer src="{{ printf $assets.katex.js.url $assets.katex.version }}" {{ with $assets.katex.js.sri }}
integrity="{{ . }}" {{ end }} crossorigin></script>
<script defer src="{{ printf $assets.katex.autoRender.url $assets.katex.version }}"
{{ with $assets.katex.autoRender.sri }} integrity="{{ . }}" {{ end }} crossorigin></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
renderMathInElement(document.body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\[", right: "\\]", display: true }
],
{{- range $key, $value := .Site.Params.math.katex }}
{{- if and (ne $value nil) (ne $value "") }}
{{- $key = partial "partials/camelize" $key }}
{{- $key | safeJS -}}: {{- $value | safeJS }},
{{- end }}
{{- end }}
});
});
</script>
{{- end }}
{{- if and .Site.GoogleAnalytics hugo.IsProduction }}
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.GoogleAnalytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '{{ .Site.GoogleAnalytics }}');
</script>
{{- end }}
{{ partial "custom-head" . }}
{{- with .Site.Params.icon }}
<link rel="icon" type="image/png" sizes="32x32" href="{{ (partial "get-icon" (dict "icon" . "size" 32)).Permalink }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ (partial "get-icon" (dict "icon" . "size" 180)).Permalink }}">
{{- end }}
{{ define "partials/get-icon" }}
{{ $icon := resources.GetMatch .icon }}
{{ $iconResized := $icon.Fill (printf "%sx%s Center" (string .size) (string .size)) }}
{{ return $iconResized }}
{{ end }}
{{- partial "components/schema" . }}
{{- partial "components/opengraph" . }}
{{- range .AlternativeOutputFormats }}
{{- printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{- end }}
|