diff --git a/src/layouts/partials/scripts.html b/src/layouts/partials/scripts.html
index 5838c6a3e..26aa98100 100644
--- a/src/layouts/partials/scripts.html
+++ b/src/layouts/partials/scripts.html
@@ -2,7 +2,7 @@
{{- $esbuildOptions := dict "target" "es2019" -}}
-{{- if eq hugo.Environment "production" -}}
+{{- if hugo.IsProduction -}}
{{- $esbuildOptions = merge $esbuildOptions (dict "minify" "true") -}}
{{- end -}}
diff --git a/src/layouts/partials/stylesheet.html b/src/layouts/partials/stylesheet.html
index 2acf259a5..44ce2b6ab 100644
--- a/src/layouts/partials/stylesheet.html
+++ b/src/layouts/partials/stylesheet.html
@@ -1,7 +1,7 @@
{{ $sassOptions := dict "targetPath" "/assets/css/style.css" "outputStyle" "expanded" "precision" 6 -}}
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}
-{{- if eq hugo.Environment "production" -}}
+{{- if hugo.IsProduction -}}
{{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}}
{{- end -}}
diff --git a/src/layouts/robots.txt b/src/layouts/robots.txt
index 271b4f1b7..bafd23893 100644
--- a/src/layouts/robots.txt
+++ b/src/layouts/robots.txt
@@ -1,8 +1,7 @@
# www.robotstxt.org
-{{- $isProduction := eq hugo.Environment "production" -}}
{{- $isNetlify := eq (getenv "NETLIFY") "true" -}}
-{{- $allowCrawling := and (not $isNetlify) $isProduction -}}
+{{- $allowCrawling := and (not $isNetlify) hugo.IsProduction -}}
{{ if $allowCrawling }}
# Allow crawling of all content