diff --git a/layouts/partials/dependencies/mathjax.html b/layouts/partials/dependencies/mathjax.html
index ae45a6a182..3b0b0913b4 100644
--- a/layouts/partials/dependencies/mathjax.html
+++ b/layouts/partials/dependencies/mathjax.html
@@ -1,11 +1,10 @@
{{- $page := .page }}
{{- with $page }}
+ {{- $init := "{}" }}
{{- if isset .Params "mathjaxinitialize" }}
- {{- $.Scratch.Set "mathJaxInitialize" .Params.mathJaxInitialize }}
+ {{- $init = .Params.mathJaxInitialize }}
{{- else if isset .Site.Params "mathjaxinitialize" }}
- {{- $.Scratch.Set "mathJaxInitialize" .Site.Params.mathJaxInitialize }}
- {{- else }}
- {{- $.Scratch.Set "mathJaxInitialize" "{}" }}
+ {{- $init = .Site.Params.mathJaxInitialize }}
{{- end }}
{{- if isset .Params "custommathjaxurl" }}
diff --git a/layouts/partials/dependencies/mermaid.html b/layouts/partials/dependencies/mermaid.html
index 52567acbb6..8dc42af60a 100644
--- a/layouts/partials/dependencies/mermaid.html
+++ b/layouts/partials/dependencies/mermaid.html
@@ -17,14 +17,13 @@
{{- else }}
{{- end }}
+ {{- $init := "{}" }}
{{- if isset .Params "mermaidinitialize" }}
- {{- $.Scratch.Set "mermaidInitialize" .Params.mermaidInitialize }}
+ {{- $init = .Params.mermaidInitialize }}
{{- else if isset .Site.Params "mermaidinitialize" }}
- {{- $.Scratch.Set "mermaidInitialize" .Site.Params.mermaidInitialize }}
- {{- else }}
- {{- $.Scratch.Set "mermaidInitialize" "{}" }}
+ {{- $init = .Site.Params.mermaidInitialize }}
{{- end }}
{{- end }}
\ No newline at end of file