hugo-theme-wondermod/layouts/partials/script.html

27 lines
1.8 KiB
HTML
Raw Normal View History

2022-07-22 00:00:36 +02:00
{{- /* Search */}}
{{- if (eq .Layout `search`) -}}
<link crossorigin="anonymous" rel="preload" as="fetch" href="../index.json">
{{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" site.Params.fuseOpts)) | resources.Minify }}
{{- $fusejs := resources.Get "js/fuse.basic.min.js" }}
{{- $license_js := resources.Get "js/license.js" }}
{{- if not site.Params.assets.disableFingerprinting }}
{{- $search := (slice $fusejs $license_js $fastsearch ) | resources.Concat "assets/js/search.js" | fingerprint }}
<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script>
{{- else }}
{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" }}
<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}"></script>
{{- end }}
{{- end -}}
{{- /* PaperMod.js */}}
{{- $scrollToTop := (not site.Params.disableScrollToTop | default .Params.disableScrollToTop ) }}
{{- $themeToggle := (not site.Params.disableThemeToggle | default .Params.disableThemeToggle ) }}
2022-10-09 04:04:32 +02:00
{{- $showCodeCopyButtons := (site.Params.ShowCodeCopyButtons | default .Params.ShowCodeCopyButtons ) }}
2022-07-22 00:00:36 +02:00
{{- $papermod := resources.Get "js/papermod.js" | js.Build (dict "params" (dict "scrollToTop" $scrollToTop "themeToggle" $themeToggle "showCodeCopyButtons" $showCodeCopyButtons)) | resources.Minify }}
{{- if not site.Params.assets.disableFingerprinting }}
{{- $papermod_js := (slice $papermod) | resources.Concat "assets/js/papermod.js" | fingerprint }}
<script defer crossorigin="anonymous" src="{{ $papermod_js.RelPermalink }}" integrity="{{ $papermod_js.Data.Integrity }}"></script>
{{- else }}
{{- $papermod_js := (slice $papermod) | resources.Concat "assets/js/papermod.js" }}
<script defer crossorigin="anonymous" type="module" src="{{ $papermod_js.RelPermalink }}"></script>
{{- end }}