Update js libs.

This commit is contained in:
Fredrik Jonsson 2026-03-14 15:01:12 +01:00
commit 0619f37c2c
2 changed files with 65 additions and 41 deletions

View file

@ -1,9 +1,6 @@
{{ $noop := .WordCount -}}
{{ $opts := dict "minify" true -}}
{{ if eq hugo.Environment "development" -}}
{{ $opts = merge $opts (dict "minify" false) -}}
{{ end -}}
{{ $opts := dict "minify" (cond hugo.IsDevelopment false true) -}}
{{ $early := resources.Get "js/script-early.js" | js.Build $opts -}}
<script>
@ -58,7 +55,7 @@
{{ end -}}
{{ if .HasShortcode "search" -}}
{{ $flexsearch := resources.Get "libs/flexsearch.compact.js" | fingerprint -}}
{{ $flexsearch := resources.Get "libs/flexsearch.compact.min.js" | fingerprint -}}
<script defer src="{{ $flexsearch.RelPermalink }}"></script>
{{ $search_opts := merge $opts (dict "params" (dict "searchLimit" (site.Params.searchLimit | default 20) "basePath" site.Home.RelPermalink)) -}}
{{ $search := resources.Get "js/search.js" | js.Build $search_opts | fingerprint -}}

View file

@ -1,14 +1,11 @@
{{ $opts := dict
"minify" true
"minify" (cond hugo.IsDevelopment false true)
"params" (dict
"cookieConsent" site.Params.cookieConsent
"piwikTrackerUrl" site.Params.piwikTrackerUrl
"piwikSiteID" site.Params.piwikSiteID
"plausibleSiteID" site.Params.plausibleSiteID
"GoogleAnalytics" site.Config.Services.GoogleAnalytics.ID) -}}
{{ if eq hugo.Environment "development" -}}
{{ $opts = merge $opts (dict "minify" false) -}}
{{ end -}}
{{ if and site.Params.piwikTrackerUrl site.Params.piwikSiteID -}}
{{ $script := resources.Get "js/tracking.js" | js.Build $opts | fingerprint -}}
<script src="{{ $script.RelPermalink }}"></script>