diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 0fda28f4..3c46dc9a 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -42,9 +42,11 @@
{{- if ne .Site.Params.footer.enable false -}}
{{- partial "footer.html" . -}}
{{- end -}}
- {{- if eq .Site.Params.pwa.enable true -}}
+ {{- if eq hugo.Environment "production" -}}
+ {{- with (eq $.Site.Params.pwa.enable "true") -}}
{{- partial "pwa.html" . -}}
{{- end -}}
+ {{- end -}}
diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html
index 92a6e4c5..72fd27b8 100644
--- a/layouts/partials/assets.html
+++ b/layouts/partials/assets.html
@@ -182,9 +182,11 @@
{{- end -}}
{{- end -}}
-{{- if eq $.Site.Params.pwa.enable true -}}
+{{- if eq hugo.Environment "production" -}}
+{{- with (eq $.Site.Params.pwa.enable "true") -}}
{{- dict "Source" "sw.js" "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
+{{- end -}}
{{- /* Cookie Consent */ -}}
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
diff --git a/layouts/partials/init.html b/layouts/partials/init.html
index 9c93d2d5..4682283e 100644
--- a/layouts/partials/init.html
+++ b/layouts/partials/init.html
@@ -32,7 +32,7 @@
{{- .Scratch.Set "comment" dict -}}
{{- end -}}
{{- else if eq .Site .Sites.First -}}
- {{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
+ {{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\", \"fingerprint\" and \"PWA\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\", \"fingerprint\" 和 \"PWA\" 不会启用.\n" -}}
{{- end -}}
{{- .Scratch.Set "params" $params -}}