From fc8a04569a81cda895d2ed8f5af12108659d4b68 Mon Sep 17 00:00:00 2001 From: sixpointcube Date: Sun, 23 Jun 2024 15:58:44 -0400 Subject: [PATCH] fix: use hugo.Environment --- layouts/_default/baseof.html | 4 ++-- layouts/partials/func/style/GetMainCSS.html | 2 +- layouts/robots.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 2060f6f..a7407ec 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -9,7 +9,7 @@ {{ hugo.Generator }} {{/* NOTE: For Production make sure you add `HUGO_ENV="production"` before your build command */}} - {{ $production := eq (getenv "HUGO_ENV") "production" | or (eq site.Params.env "production") }} + {{ $production := eq (getenv "HUGO_ENV") "production" | or (eq hugo.Environment "production") }} {{ $public := not .Params.private }} {{ if and $production $public }} @@ -51,7 +51,7 @@ {{- template "_internal/schema.html" . -}} {{- template "_internal/twitter_cards.html" . -}} - {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} + {{ if eq (getenv "HUGO_ENV") "production" | or (eq hugo.Environment "production") }} {{ template "_internal/google_analytics.html" . }} {{ end }} {{ block "head" . }}{{ partial "head-additions.html" . }}{{ end }} diff --git a/layouts/partials/func/style/GetMainCSS.html b/layouts/partials/func/style/GetMainCSS.html index 53c4ba1..f036564 100644 --- a/layouts/partials/func/style/GetMainCSS.html +++ b/layouts/partials/func/style/GetMainCSS.html @@ -68,7 +68,7 @@ css asset directory we (unless condition below) add to aforementioned slice */}} {{ $options := dict "enableSourceMap" true "precision" 6 }} {{ $style = $style | resources.ToCSS $options | minify }} {{/* We fingerprint in production for cache busting purposes */}} - {{ if eq (getenv "HUGO_ENV") "production" }} + {{ if (eq hugo.Environment "production") }} {{ $style = $style | fingerprint }} {{ end }} {{/* We're ready to set returning variable with resulting resource */}} diff --git a/layouts/robots.txt b/layouts/robots.txt index d4efb29..7fea9b9 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -1,6 +1,6 @@ User-agent: * {{/* robotstxt.org - if ENV production variable is false robots will be disallowed. */ -}} -{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") -}} +{{ if eq (getenv "HUGO_ENV") "production" | or (eq hugo.Environment "production") -}} Allow: / Sitemap: {{ "/sitemap.xml" | absURL }} {{ else -}}