From fcf13346af384bc7153e1582c140539ddec9e14e Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Sat, 21 May 2022 12:31:47 +0800 Subject: [PATCH] :zap: Perf: use build-in function hugo.IsProduction --- layouts/partials/assets.html | 2 +- layouts/partials/init.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index 79cf63ef..6caeabd2 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -196,7 +196,7 @@ {{- end -}} {{- /* PWA */ -}} -{{- if eq hugo.Environment "production" -}} +{{- if hugo.IsProduction -}} {{- $config = dict "enablePWA" .Site.Params.enablePWA | merge $config -}} {{- end -}} diff --git a/layouts/partials/init.html b/layouts/partials/init.html index f3404447..f5df0b17 100644 --- a/layouts/partials/init.html +++ b/layouts/partials/init.html @@ -21,7 +21,7 @@ {{- $toc = dict "enable" false -}} {{- end -}} -{{- if eq hugo.Environment "production" -}} +{{- if hugo.IsProduction -}} {{- $cdn := .Site.Params.cdn -}} {{- with $cdn.data -}} {{- $cdnData := printf "data/cdn/%v" . | resources.Get | transform.Unmarshal -}}