Skip to content

Commit cddad56

Browse files
committed
fix
1 parent 58803d8 commit cddad56

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed

layouts/partials/head.html

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
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+
10+
{{- /* Title */}}
11+
<title>{{ if .IsHome }}{{ else }}{{ if .Title }}{{ .Title }} | {{ end }}{{ end }}{{ site.Title }}</title>
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+
<meta name="description" content="{{- with .Description }}{{ . }}{{- else }}{{- if or .IsPage .IsSection}}
22+
{{- .Summary | default (printf "%s - %s" .Title site.Title) }}{{- else }}
23+
{{- with site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}">
24+
<meta name="author" content="{{ (partial "author.html" . ) }}">
25+
<link rel="canonical" href="{{ if .Params.canonicalURL -}} {{ trim .Params.canonicalURL " " }} {{- else -}} {{ .Permalink }} {{- end }}">
26+
{{- if site.Params.analytics.google.SiteVerificationTag }}
27+
<meta name="google-site-verification" content="{{ site.Params.analytics.google.SiteVerificationTag }}">
28+
{{- end }}
29+
{{- if site.Params.analytics.yandex.SiteVerificationTag }}
30+
<meta name="yandex-verification" content="{{ site.Params.analytics.yandex.SiteVerificationTag }}">
31+
{{- end }}
32+
{{- if site.Params.analytics.bing.SiteVerificationTag }}
33+
<meta name="msvalidate.01" content="{{ site.Params.analytics.bing.SiteVerificationTag }}">
34+
{{- end }}
35+
{{- if site.Params.analytics.naver.SiteVerificationTag }}
36+
<meta name="naver-site-verification" content="{{ site.Params.analytics.naver.SiteVerificationTag }}">
37+
{{- end }}
38+
39+
{{- /* Styles */}}
40+
41+
{{- /* includes */}}
42+
{{- $includes := slice }}
43+
{{- $includes = $includes | append (" " | resources.FromString "assets/css/includes-blank.css")}}
44+
45+
{{- if not (eq site.Params.assets.disableScrollBarStyle true) }}
46+
{{- $ScrollStyle := (resources.Get "css/includes/scroll-bar.css") }}
47+
{{- $includes = (append $ScrollStyle $includes) }}
48+
{{- end }}
49+
50+
{{- $includes_all := $includes | resources.Concat "assets/css/includes.css" }}
51+
52+
{{- $theme_vars := (resources.Get "css/core/theme-vars.css") }}
53+
{{- $reset := (resources.Get "css/core/reset.css") }}
54+
{{- $media := (resources.Get "css/core/zmedia.css") }}
55+
{{- $license_css := (resources.Get "css/core/license.css") }}
56+
{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }}
57+
58+
{{- /* markup.highlight.noClasses should be set to `false` */}}
59+
{{- $chroma_styles := (resources.Get "css/includes/chroma-styles.css") }}
60+
{{- $chroma_mod := (resources.Get "css/includes/chroma-mod.css") }}
61+
62+
{{- /* order is important */}}
63+
{{- $core := (slice $theme_vars $reset $common $chroma_styles $chroma_mod $includes_all $media) | resources.Concat "assets/css/core.css" | resources.Minify }}
64+
{{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" | resources.Minify }}
65+
66+
{{- /* bundle all required css */}}
67+
{{- /* Add extended css after theme style */ -}}
68+
{{- $stylesheet := (slice $license_css $core $extended) | resources.Concat "assets/css/stylesheet.css" }}
69+
70+
{{- if not site.Params.assets.disableFingerprinting }}
71+
{{- $stylesheet := $stylesheet | fingerprint }}
72+
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" as="style">
73+
{{- else }}
74+
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style">
75+
{{- end }}
76+
77+
{{- /* Search */}}
78+
{{- if (eq .Layout `search`) -}}
79+
<link crossorigin="anonymous" rel="preload" as="fetch" href="../index.json">
80+
{{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" site.Params.fuseOpts)) | resources.Minify }}
81+
{{- $fusejs := resources.Get "js/fuse.basic.min.js" }}
82+
{{- $license_js := resources.Get "js/license.js" }}
83+
{{- if not site.Params.assets.disableFingerprinting }}
84+
{{- $search := (slice $fusejs $license_js $fastsearch ) | resources.Concat "assets/js/search.js" | fingerprint }}
85+
<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script>
86+
{{- else }}
87+
{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" }}
88+
<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}"></script>
89+
{{- end }}
90+
{{- end -}}
91+
92+
{{- /* Favicons */}}
93+
<link rel="icon" href="{{ site.Params.assets.favicon | default "favicon.ico" | absURL }}">
94+
<link rel="icon" type="image/png" sizes="16x16" href="{{ site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL }}">
95+
<link rel="icon" type="image/png" sizes="32x32" href="{{ site.Params.assets.favicon32x32 | default "favicon-32x32.png" | absURL }}">
96+
<link rel="apple-touch-icon" href="{{ site.Params.assets.apple_touch_icon | default "apple-touch-icon.png" | absURL }}">
97+
<link rel="mask-icon" href="{{ site.Params.assets.safari_pinned_tab | default "safari-pinned-tab.svg" | absURL }}">
98+
<meta name="theme-color" content="{{ site.Params.assets.theme_color | default "#2e2e33" }}">
99+
<meta name="msapplication-TileColor" content="{{ site.Params.assets.msapplication_TileColor | default "#2e2e33" }}">
100+
101+
{{- /* RSS */}}
102+
{{ range .AlternativeOutputFormats -}}
103+
<link rel="{{ .Rel }}" type="{{ .MediaType.Type | html }}" href="{{ .Permalink | safeURL }}">
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: rgb(29, 30, 32);
122+
--entry: rgb(46, 46, 51);
123+
--primary: rgb(218, 218, 219);
124+
--secondary: rgb(155, 156, 157);
125+
--tertiary: rgb(65, 66, 68);
126+
--content: rgb(196, 196, 197);
127+
--code-block-bg: rgb(46, 46, 51);
128+
--code-bg: rgb(55, 56, 62);
129+
--border: rgb(51, 51, 51);
130+
}
131+
132+
.list {
133+
background: var(--theme);
134+
}
135+
136+
.list:not(.dark)::-webkit-scrollbar-track {
137+
background: 0 0;
138+
}
139+
140+
.list:not(.dark)::-webkit-scrollbar-thumb {
141+
border-color: var(--theme);
142+
}
143+
}
144+
145+
</style>
146+
{{- end }}
147+
</noscript>
148+
149+
{{- partial "extend_head.html" . -}}
150+
151+
{{- /* Misc */}}
152+
{{- if hugo.IsProduction | or (eq site.Params.env "production") }}
153+
{{- template "_internal/google_analytics.html" . }}
154+
{{- template "partials/templates/opengraph.html" . }}
155+
{{- template "partials/templates/twitter_cards.html" . }}
156+
{{- template "partials/templates/schema_json.html" . }}
157+
{{- end -}}

0 commit comments

Comments
 (0)