From 86f316351556bc4da00df37312bb3bbf1652e6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sat, 12 Nov 2022 21:00:06 +0100 Subject: [PATCH] theme: reduce calls to output-format.hugo #380 --- layouts/partials/footer.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index f7f8846680..a4f77dc16a 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -6,7 +6,8 @@ -{{- $wantsMathJax := or (.Page.Store.Get "hasMathJax") (and (.Page.Store.Get (printf "%sIsNested" (partial "output-format.hugo" .Page))) (.Page.Store.Get "nestedHasMathJax")) }} +{{- $outputFormat := partial "output-format.hugo" .Page }} +{{- $wantsMathJax := or (.Page.Store.Get "hasMathJax") (and (.Page.Store.Get (printf "%sIsNested" $outputFormat)) (.Page.Store.Get "nestedHasMathJax")) }} {{- if $wantsMathJax }} {{- if isset .Params "mathjaxinitialize" }} {{- $.Scratch.Set "mathJaxInitialize" .Params.mathJaxInitialize }} @@ -51,7 +52,7 @@ {{- end }} {{- end }} -{{- $wantsMermaid := or (.Page.Store.Get "hasMermaid") (and (.Page.Store.Get (printf "%sIsNested" (partial "output-format.hugo" .Page))) (.Page.Store.Get "nestedHasMermaid")) }} +{{- $wantsMermaid := or (.Page.Store.Get "hasMermaid") (and (.Page.Store.Get (printf "%sIsNested" $outputFormat)) (.Page.Store.Get "nestedHasMermaid")) }} {{- if $wantsMermaid }} {{- if isset .Params "custommermaidurl" }} @@ -72,7 +73,7 @@ window.themeUseMermaid = JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}); {{- end }} -{{- $wantsSwagger := or (.Page.Store.Get "hasSwagger") (and (.Page.Store.Get (printf "%sIsNested" (partial "output-format.hugo" .Page))) (.Page.Store.Get "nestedHasSwagger")) }} +{{- $wantsSwagger := or (.Page.Store.Get "hasSwagger") (and (.Page.Store.Get (printf "%sIsNested" $outputFormat)) (.Page.Store.Get "nestedHasSwagger")) }} {{- if $wantsSwagger }} {{- if isset .Params "customswaggerurl" }}