Merge pull request #102 from iakunin/issue-101

#101: Simplifying environment detection
This commit is contained in:
Dmitry Kolosov 2021-10-06 09:32:49 +03:00 committed by GitHub
commit 4768cf6f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View File

@ -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/).

View File

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

View File

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

View File

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