summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html12
-rw-r--r--layouts/partials/head.html3
-rw-r--r--layouts/partials/scripts.html14
3 files changed, 27 insertions, 2 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 4985ca3..5f095c2 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,7 +1,8 @@
<!DOCTYPE html>
-<html lang="{{ site.LanguageCode | default site.Language.Lang }}" {{- with partialCached "func/GetLanguageDirection" "GetLanguageDirection" }} dir="{{ . }}" {{- end }} prefix="og: http://ogp.me/ns#">
+<html lang="{{ site.LanguageCode | default site.Language.Lang }}" {{- with partialCached "func/GetLanguageDirection" "GetLanguageDirection" }} dir="{{ . }}" {{- end }} prefix="og: http://ogp.me/ns#" id="top-of-site">
{{ partial "head.html" . }}
<body class="theme-base-{{ site.Params.colorScheme }}">
+ <div id="top-of-site-anchor"></div>
{{ if .Params.toc }}
{{ partial "sidebar-toc.html" . }}
{{ else }}
@@ -23,5 +24,14 @@
</div>
<label for="sidebar-checkbox" class="sidebar-toggle"></label>
+
+ <a href="#top-of-site" class="top-of-site-link" data-visible="false">
+ <span class="screen-reader-text" aria-label="{{ i18n "back_to_top_label" }}">
+ {{ i18n "back_to_top" }}
+ </span>
+ <svg width="32" height="32" viewBox="0 0 100 100">
+ <path fill="white" d="m50 0c-13.262 0-25.98 5.2695-35.355 14.645s-14.645 22.094-14.645 35.355 5.2695 25.98 14.645 35.355 22.094 14.645 35.355 14.645 25.98-5.2695 35.355-14.645 14.645-22.094 14.645-35.355-5.2695-25.98-14.645-35.355-22.094-14.645-35.355-14.645zm20.832 62.5-20.832-22.457-20.625 22.457c-1.207 0.74219-2.7656 0.57812-3.7891-0.39844-1.0273-0.98047-1.2695-2.5273-0.58594-3.7695l22.918-25c0.60156-0.61328 1.4297-0.96094 2.2891-0.96094 0.86328 0 1.6914 0.34766 2.293 0.96094l22.918 25c0.88672 1.2891 0.6875 3.0352-0.47266 4.0898-1.1562 1.0508-2.9141 1.0859-4.1133 0.078125z"></path>
+ </svg>
+ </a>
</body>
</html>
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 934ccc9..036b26d 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -35,6 +35,7 @@
{{- template "partials/templates/twitter_cards.html" . }}
{{- template "partials/templates/schema_json.html" . }}
- {{- /* SEO */}}
+ {{- /* Scripts */}}
+ {{- partial "partials/scripts.html" . }}
{{- partial "partials/seo/ga.html" . }}
</head>
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
new file mode 100644
index 0000000..a42e492
--- /dev/null
+++ b/layouts/partials/scripts.html
@@ -0,0 +1,14 @@
+{{- $isProduction := (or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production")) -}}
+
+{{- $scripts := slice -}}
+{{- $scripts = $scripts | append (resources.Get "js/ed.js") -}}
+{{- $scripts = $scripts | resources.Concat "js/common.js" -}}
+
+{{- $scripts = $scripts | js.Build (dict "format" "iife" "minify" $isProduction) -}}
+
+{{- if or (site.Params.assets.disable_fingerprinting) (not $isProduction) }}
+ <script src="{{ $scripts.RelPermalink }}"></script>
+{{- else -}}
+ {{- $scripts = $scripts | fingerprint }}
+ <script src="{{ $scripts.RelPermalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>
+{{- end -}}