diff --git a/layouts/_partials/assets.html b/layouts/_partials/assets.html index 463dfad0..beab4010 100644 --- a/layouts/_partials/assets.html +++ b/layouts/_partials/assets.html @@ -156,7 +156,7 @@ FixIt theme assets partial {{- end -}} {{- /* Mapbox GL */ -}} -{{- if .HasShortcode "mapbox" -}} +{{- if .Store.Get "hasMapbox" -}} {{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.css" -}} {{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}} {{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}} @@ -166,7 +166,7 @@ FixIt theme assets partial {{- end -}} {{- /* Music */ -}} -{{- if (.HasShortcode "aplayer") | or (.HasShortcode "music") -}} +{{- if (.Store.Get "hasAplayer") | or (.Store.Get "hasMusic") -}} {{- /* APlayer */ -}} {{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}} @@ -175,14 +175,14 @@ FixIt theme assets partial {{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} - {{- if .HasShortcode "aplayer" -}} + {{- if .Store.Get "hasAplayer" -}} {{- $options := dict "targetPath" "js/lib/aplayer.min.js" "minify" hugo.IsProduction -}} {{- if not hugo.IsProduction -}} {{- $options = dict "sourceMap" "external" | merge $options -}} {{- end -}} {{- dict "Source" (resources.Get "js/lib/aplayer.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- end -}} - {{- if .HasShortcode "music" -}} + {{- if .Store.Get "hasMusic" -}} {{- /* MetingJS */ -}} {{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} @@ -232,7 +232,7 @@ FixIt theme assets partial {{- end -}} {{- /* Content Decryption */ -}} -{{- $encryptPartial := .HasShortcode "fixit-encryptor" -}} +{{- $encryptPartial := .Store.Get "hasEncryptor" -}} {{- if $params.password | or $encryptPartial -}} {{- $cryptoCoreJS := $cdn.cryptoCoreJS | default "lib/crypto-js/core.js" -}} {{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}} diff --git a/layouts/_partials/init/index.html b/layouts/_partials/init/index.html index 95155a99..3fe9d8f8 100644 --- a/layouts/_partials/init/index.html +++ b/layouts/_partials/init/index.html @@ -1,4 +1,4 @@ -{{- hugo.Store.Set "version" "v0.4.3" -}} +{{- hugo.Store.Set "version" "v0.4.4-20260304032604-ba63d67a" -}} {{- .Store.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/layouts/_shortcodes/aplayer.html b/layouts/_shortcodes/aplayer.html index 9f15eea8..2b8f37d7 100644 --- a/layouts/_shortcodes/aplayer.html +++ b/layouts/_shortcodes/aplayer.html @@ -18,6 +18,7 @@ {{- $audio = replace $audio "}" "}," | printf "[%s]" -}} {{- $audio = replace $audio ",]" "]" -}}
+ {{- .Page.Store.Set "hasAplayer" true -}} {{- else -}} {{- errorf "Only named params is supported: %s" .Position -}} {{- end -}} diff --git a/layouts/_shortcodes/fixit-encryptor.html b/layouts/_shortcodes/fixit-encryptor.html index 15de7c6f..67e74ddf 100644 --- a/layouts/_shortcodes/fixit-encryptor.html +++ b/layouts/_shortcodes/fixit-encryptor.html @@ -6,6 +6,7 @@ {{- $content := .Inner | .Page.RenderString -}} {{- /* Content Encryption */ -}} {{- dict "Content" $content "Password" $password "Message" $message "IsPartial" true "Page" .Page | partial "plugin/fixit-encryptor.html" -}} + {{- .Page.Store.Set "hasEncryptor" true -}} {{- else -}} {{- .Inner -}} {{- end -}} diff --git a/layouts/_shortcodes/mapbox.html b/layouts/_shortcodes/mapbox.html index 6572b673..f13bda00 100644 --- a/layouts/_shortcodes/mapbox.html +++ b/layouts/_shortcodes/mapbox.html @@ -33,4 +33,4 @@ {{- $attrs := printf `style="width: %v; height: %v;"` $width $height -}}
-{{- /* EOF */ -}} +{{- .Page.Store.Set "hasMapbox" true -}} diff --git a/layouts/_shortcodes/music.html b/layouts/_shortcodes/music.html index b0ad1b8b..5bb2d3b1 100644 --- a/layouts/_shortcodes/music.html +++ b/layouts/_shortcodes/music.html @@ -47,3 +47,4 @@ {{- else -}} {{- end -}} +{{- .Page.Store.Set "hasMusic" true -}}