forked from scientific-python/scientific-python-hugo-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.html
More file actions
28 lines (22 loc) · 1.26 KB
/
javascript.html
File metadata and controls
28 lines (22 loc) · 1.26 KB
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
{{- $inServerMode := hugo.IsServer -}}
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css" integrity="sha512-2SwdPD6INVrV/lHTZbO2nodKhrnDdJK9/kg2XD1r9uGqPo1cUbujc+IYdlYdEErWNu69gVcYgdxlmVmzTWnetw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- Custom JS -->
<!-- All JS files under assets/js are included -->
{{- $jsFiles := collections.Sort (resources.Match "js/*.js") "Name" -}}
{{- if $inServerMode -}}
{{- $js := $jsFiles | resources.Concat "js/bundle.js" }}
<script type="text/javascript" src={{ $js.RelPermalink }}></script>
{{ else }}
{{- $js := $jsFiles | resources.Concat "js/bundle.js" | resources.Minify }}
<script type="text/javascript" src={{ $js.RelPermalink }}></script>
{{- end -}}
<script type="text/javascript">setupShortcuts(maxLevel={{ default 2 .Page.Params.shortcutDepth }});</script>
{{- if .Page.Store.Get "hasMermaid" }}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11.4.0/dist/mermaid.esm.min.mjs';
const theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? 'dark' : 'default';
mermaid.initialize({ startOnLoad: false, theme: theme });
await mermaid.run({ querySelector: '.mermaid' });
</script>
{{ end -}}