#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.
|
If you want font awesome icons, download "Font Awesome For Desktop" and open svg directory.
|
||||||
|
|
||||||
### Google Analytics
|
### Google Analytics
|
||||||
Only works for production environment. You either build your site with variable like
|
Only works for production environment.
|
||||||
`HUGO_ENV=production hugo --minify`
|
|
||||||
or just put `env: production` to `params` section of config.
|
|
||||||
|
|
||||||
### Multilingual mode
|
### 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/).
|
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:tag" content="">
|
||||||
<meta property="article:publisher" content="https://www.facebook.com/XXX"> -->
|
<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" . }}
|
{{ template "_internal/google_analytics.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
{{ if $resource }}
|
{{ if $resource }}
|
||||||
{{ $resource := $resource | resources.ExecuteAsTemplate $targetFilename . }}
|
{{ $resource := $resource | resources.ExecuteAsTemplate $targetFilename . }}
|
||||||
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
|
{{ if hugo.IsProduction }}
|
||||||
{{ $resource = $resource | resources.Minify }}
|
{{ $resource = $resource | resources.Minify }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $resource = $resource | resources.Fingerprint "sha256" }}
|
{{ $resource = $resource | resources.Fingerprint "sha256" }}
|
||||||
@ -26,4 +26,4 @@
|
|||||||
{{ else if eq .type "js" }}
|
{{ else if eq .type "js" }}
|
||||||
<script src="{{ .filename | absURL }}?rnd={{ now.Unix }}" type="text/javascript" charset="utf-8"></script>
|
<script src="{{ .filename | absURL }}?rnd={{ now.Unix }}" type="text/javascript" charset="utf-8"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
User-agent: *
|
User-agent: *
|
||||||
# robotstxt.org - if ENV production variable is false robots will be disallowed.
|
# robotstxt.org - if environment is not `production` then robots will be disallowed.
|
||||||
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
|
{{ if hugo.IsProduction }}
|
||||||
Disallow:
|
Disallow:
|
||||||
{{ else }}
|
{{ else }}
|
||||||
Disallow: /
|
Disallow: /
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user