fediversity.eu/themes/hugoplate/layouts/partials/essentials/script.html

46 lines
1.3 KiB
HTML
Raw Permalink Normal View History

2024-03-26 16:28:28 +01:00
<!-- JS Plugins + Main script -->
2024-03-27 12:24:18 +01:00
{{ $scripts := slice }} {{ $scriptsLazy := slice }} {{ range
site.Params.plugins.js }} {{ if findRE "^http" .link }}
<script
src="{{ .link | relURL }}"
type="application/javascript"
{{
.attributes
|
safeHTMLAttr
}}
></script>
{{ else }} {{ if not .lazy }} {{ $scripts = $scripts | append (resources.Get
.link) }} {{ else }} {{ $scriptsLazy = $scriptsLazy | append (resources.Get
.link) }} {{ end }} {{ end }} {{ end }}
2024-03-26 16:28:28 +01:00
<!-- main script -->
2024-03-27 12:24:18 +01:00
{{ $scripts = $scripts | append (resources.Get "js/main.js") }} {{ $scripts =
$scripts | resources.Concat "js/script.js" }} {{ $scriptsLazy = $scriptsLazy |
resources.Concat "js/script-lazy.js" }} {{ if hugo.IsProduction }} {{ $scripts =
$scripts | minify | fingerprint }} {{ $scriptsLazy = $scriptsLazy | minify |
fingerprint }} {{ end }} {{/* scripts */}}
2024-03-26 16:28:28 +01:00
<script
crossorigin="anonymous"
integrity="{{ $scripts.Data.Integrity }}"
2024-03-27 12:24:18 +01:00
src="{{ $scripts.RelPermalink }}"
></script>
2024-03-26 16:28:28 +01:00
{{/* scripts lazy */}}
<script
defer
async
crossorigin="anonymous"
integrity="{{ $scriptsLazy.Data.Integrity }}"
2024-03-27 12:24:18 +01:00
src="{{ $scriptsLazy.RelPermalink }}"
></script>
2024-03-26 16:28:28 +01:00
<!-- progressive web app -->
{{ partialCached "pwa.html" . }}
<!-- cookie consent -->
{{ partialCached "cookie-consent.html" . }}
<!-- google adsense -->
{{ partialCached "adsense-script.html" . }}