#101: Simplifying environment detection
This commit is contained in:
parent
f996392dda
commit
4d405ead5d
@ -167,9 +167,7 @@ Icon should be "static/fa-icons/google.svg"
|
||||
If you want font awesome icons, download "Font Awesome For Desktop" and open svg directory.
|
||||
|
||||
### Google Analytics
|
||||
Only works for production environment. You either build your site with variable like
|
||||
`HUGO_ENV=production hugo --minify`
|
||||
or just put `env: production` to `params` section of config.
|
||||
Only works for production environment.
|
||||
|
||||
### Multilingual mode
|
||||
Check config/example usage in [exampleSiteMultilingual](https://github.com/Mitrichius/hugo-theme-anubis/tree/master/exampleSiteMultilingual) directory and documentation on [Hugo site](https://gohugo.io/content-management/multilingual/).
|
||||
|
@ -41,7 +41,7 @@
|
||||
<meta property="article:tag" content="">
|
||||
<meta property="article:publisher" content="https://www.facebook.com/XXX"> -->
|
||||
|
||||
{{ if and (.Site.GoogleAnalytics) (or (eq (getenv "HUGO_ENV") "production") (eq .Site.Params.env "production")) }}
|
||||
{{ if and (.Site.GoogleAnalytics) (hugo.IsProduction) }}
|
||||
{{ template "_internal/google_analytics.html" . }}
|
||||
{{ end }}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
{{ if $resource }}
|
||||
{{ $resource := $resource | resources.ExecuteAsTemplate $targetFilename . }}
|
||||
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $resource = $resource | resources.Minify }}
|
||||
{{ end }}
|
||||
{{ $resource = $resource | resources.Fingerprint "sha256" }}
|
||||
@ -26,4 +26,4 @@
|
||||
{{ else if eq .type "js" }}
|
||||
<script src="{{ .filename | absURL }}?rnd={{ now.Unix }}" type="text/javascript" charset="utf-8"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -1,7 +1,7 @@
|
||||
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") }}
|
||||
# robotstxt.org - if environment is not `production` then robots will be disallowed.
|
||||
{{ if hugo.IsProduction }}
|
||||
Disallow:
|
||||
{{ else }}
|
||||
Disallow: /
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user