fix: use hugo.Environment

This commit is contained in:
sixpointcube 2024-06-23 15:58:44 -04:00
parent 673abbaba2
commit fc8a04569a
3 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
{{ 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 }}
<meta name="robots" content="index, follow">
@ -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 }}

View File

@ -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 */}}

View File

@ -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 -}}