main
html 198 lines 8.01 KB
Raw
1 <meta charset="utf-8">
2 <meta http-equiv="X-UA-Compatible" content="IE=edge">
3 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
4 {{- if hugo.IsProduction | or (eq site.Params.env "production") | and (ne .Params.robotsNoIndex true) }}
5 <meta name="robots" content="index, follow">
6 {{- else }}
7 <meta name="robots" content="noindex, nofollow">
8 {{- end }}
9 <meta name="ai-generated" content="true">
10
11 {{- partial "seo.html" . -}}
12
13 {{- /* Meta */}}
14 {{- if .IsHome }}
15 {{ with site.Params.keywords -}}<meta name="keywords" content="{{- range $i, $e := . }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}">{{ end }}
16 {{- else }}
17 <meta name="keywords" content="{{ if .Params.keywords -}}
18 {{- range $i, $e := .Params.keywords }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- else }}
19 {{- range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- end -}}">
20 {{- end }}
21 {{- if site.Params.analytics.google.SiteVerificationTag }}
22 <meta name="google-site-verification" content="{{ site.Params.analytics.google.SiteVerificationTag }}">
23 {{- end }}
24 {{- if site.Params.analytics.yandex.SiteVerificationTag }}
25 <meta name="yandex-verification" content="{{ site.Params.analytics.yandex.SiteVerificationTag }}">
26 {{- end }}
27 {{- if site.Params.analytics.bing.SiteVerificationTag }}
28 <meta name="msvalidate.01" content="{{ site.Params.analytics.bing.SiteVerificationTag }}">
29 {{- end }}
30 {{- if site.Params.analytics.naver.SiteVerificationTag }}
31 <meta name="naver-site-verification" content="{{ site.Params.analytics.naver.SiteVerificationTag }}">
32 {{- end }}
33
34 {{- /* Styles */}}
35 {{- $font_href := "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" }}
36 <link rel="preconnect" href="https://fonts.googleapis.com">
37 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
38 <link rel="preload" as="style" href="{{ $font_href }}">
39 <link rel="stylesheet" href="{{ $font_href }}">
40
41 {{- /* includes */}}
42 {{- $includes := slice }}
43 {{- $includes = $includes | append (" " | resources.FromString "assets/css/includes-blank.css")}}
44
45 {{- $includes_all := $includes | resources.Concat "assets/css/includes.css" }}
46
47 {{- $tokens := (resources.Get "css/tokens.css") }}
48 {{- $theme_vars := (resources.Get "css/core/theme-vars.css") }}
49 {{- $reset := (resources.Get "css/core/reset.css") }}
50 {{- $media := (resources.Get "css/core/zmedia.css") }}
51 {{- $license_css := (resources.Get "css/core/license.css") }}
52 {{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }}
53
54 {{- /* markup.highlight.noClasses should be set to `false` */}}
55 {{- $chroma_styles := (resources.Get "css/includes/chroma-styles.css") }}
56 {{- $chroma_mod := (resources.Get "css/includes/chroma-mod.css") }}
57
58 {{- /* order is important */}}
59 {{- $core := (slice $tokens $theme_vars $reset $common $chroma_styles $chroma_mod $includes_all $media) | resources.Concat "assets/css/core.css" | resources.Minify }}
60 {{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" | resources.Minify }}
61
62 {{- /* bundle all required css */}}
63 {{- /* Add extended css after theme style */ -}}
64 {{- $stylesheet := (slice $license_css $core $extended) | resources.Concat "assets/css/stylesheet.css" }}
65
66 {{- if not site.Params.assets.disableFingerprinting }}
67 {{- $stylesheet := $stylesheet | fingerprint }}
68 <link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" as="style">
69 {{- else }}
70 <link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style">
71 {{- end }}
72
73 {{- /* Search */}}
74 {{- if (and (eq .Layout `search`) (not .Params.pagefind)) -}}
75 <link crossorigin="anonymous" rel="preload" as="fetch" href="../index.json">
76 {{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" site.Params.fuseOpts)) | resources.Minify }}
77 {{- $fusejs := resources.Get "js/fuse.basic.min.js" }}
78 {{- $license_js := resources.Get "js/license.js" }}
79 {{- if not site.Params.assets.disableFingerprinting }}
80 {{- $search := (slice $fusejs $license_js $fastsearch ) | resources.Concat "assets/js/search.js" | fingerprint }}
81 <script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script>
82 {{- else }}
83 {{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" }}
84 <script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}"></script>
85 {{- end }}
86 {{- end -}}
87
88 {{- /* Favicons */}}
89 {{- with resources.Get "images/claracle.jpeg" }}
90 {{- $favicon16 := .Fill "16x16 png" }}
91 {{- $favicon32 := .Fill "32x32 png" }}
92 {{- $appleTouchIcon := .Fill "180x180 png" }}
93 <link rel="icon" type="image/png" sizes="16x16" href="{{ $favicon16.RelPermalink }}">
94 <link rel="icon" type="image/png" sizes="32x32" href="{{ $favicon32.RelPermalink }}">
95 <link rel="apple-touch-icon" sizes="180x180" href="{{ $appleTouchIcon.RelPermalink }}">
96 {{- end }}
97 <link rel="manifest" href="/site.webmanifest">
98 <meta name="theme-color" content="#0066CC">
99 <meta name="msapplication-TileColor" content="#0066CC">
100
101 {{- /* RSS */}}
102 {{ range .AlternativeOutputFormats -}}
103 <link rel="{{ .Rel }}" type="{{ .MediaType.Type | html }}" href="{{ .Permalink | safeURL }}" title="{{ .Name }}">
104 {{ end -}}
105 {{- range .AllTranslations -}}
106 <link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
107 {{ end -}}
108
109 <noscript>
110 <style>
111 #theme-toggle,
112 .top-link {
113 display: none;
114 }
115
116 </style>
117 {{- if (and (ne site.Params.defaultTheme "light") (ne site.Params.defaultTheme "dark")) }}
118 <style>
119 @media (prefers-color-scheme: dark) {
120 :root {
121 --theme: var(--color-bg);
122 --entry: var(--color-surface);
123 --primary: var(--color-text);
124 --secondary: var(--color-text-muted);
125 --tertiary: var(--color-accent-muted);
126 --content: var(--color-text);
127 --code-block-bg: var(--color-code-block-bg);
128 --code-bg: var(--color-code-bg);
129 --border: var(--color-border);
130 color-scheme: dark;
131 }
132
133 .list {
134 background: var(--theme);
135 }
136
137 .toc {
138 background: var(--entry);
139 }
140 }
141
142 </style>
143 {{- end }}
144 </noscript>
145
146 {{- /* theme-toggle is enabled */}}
147 {{- if (not site.Params.disableThemeToggle) }}
148 {{- /* theme is light */}}
149 {{- if (eq site.Params.defaultTheme "light") }}
150 <script>
151 if (localStorage.getItem("pref-theme") === "dark") {
152 document.querySelector("html").dataset.theme = 'dark';
153 }
154
155 </script>
156 {{- /* theme is dark */}}
157 {{- else if (eq site.Params.defaultTheme "dark") }}
158 <script>
159 if (localStorage.getItem("pref-theme") === "light") {
160 document.querySelector("html").dataset.theme = 'light';
161 }
162
163 </script>
164 {{- else }}
165 {{- /* theme is auto */}}
166 <script>
167 if (localStorage.getItem("pref-theme") === "dark") {
168 document.querySelector("html").dataset.theme = 'dark';
169 } else if (localStorage.getItem("pref-theme") === "light") {
170 document.querySelector("html").dataset.theme = 'light';
171 } else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
172 document.querySelector("html").dataset.theme = 'dark';
173 } else {
174 document.querySelector("html").dataset.theme = 'light';
175 }
176
177 </script>
178 {{- end }}
179 {{- /* theme-toggle is disabled and theme is auto */}}
180 {{- else if (and (ne site.Params.defaultTheme "light") (ne site.Params.defaultTheme "dark"))}}
181 <script>
182 if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
183 document.querySelector("html").dataset.theme = 'dark';
184 } else {
185 document.querySelector("html").dataset.theme = 'light';
186 }
187
188 </script>
189 {{- end }}
190
191 {{- partial "extend_head.html" . -}}
192 {{- partial "analytics.html" . -}}
193 {{- partial "cookie-consent.html" . -}}
194
195 {{- /* Misc */}}
196 {{- if hugo.IsProduction | or (eq site.Params.env "production") }}
197 {{- partial "google_analytics.html" . }}
198 {{- end -}}