Continue supporting HUGO_ENV

Revert some of the changes done in
a7324c5f15effe5d2b78992fc7b829b29152a7f9. Continue supporting the
environment variable "HUGO_ENV" which doesn't affect Hugo while still
supporting the new, official ways of setting the environment.

<body> will however get a class named by the official environment only
since it would be confusing to add both a "development" class and a
"production" class at the same time if the site is rendered using this
command for instance:

  $ HUGO_ENV=production hugo server
This commit is contained in:
Laban Sköllermark 2019-08-22 00:52:13 +02:00
parent f3388f4fef
commit 457e8fdcee
2 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width,minimum-scale=1">
{{ .Hugo.Generator }}
{{/* NOTE: For Production make sure you add `HUGO_ENVIRONMENT="production"` before your build command */}}
{{ if eq hugo.Environment "production" }}
{{ if eq (getenv "HUGO_ENV") "production" | or (eq hugo.Environment "production") }}
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
{{ else }}
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">

View File

@ -1,6 +1,6 @@
User-agent: *
# robotstxt.org - if environment is not production robots will be disallowed.
{{ if eq hugo.Environment "production" }}
{{ if eq (getenv "HUGO_ENV") "production" | or (eq hugo.Environment "production") }}
Disallow:
{{ else }}
Disallow: /