diff --git a/README.md b/README.md index b5aa30d..ca54e62 100644 --- a/README.md +++ b/README.md @@ -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/). diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 5aaa6cd..8dfcd5c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -41,7 +41,7 @@ --> -{{ 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 }} diff --git a/layouts/partials/resource.html b/layouts/partials/resource.html index 146c902..1ecc5e5 100644 --- a/layouts/partials/resource.html +++ b/layouts/partials/resource.html @@ -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" }} {{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/robots.txt b/layouts/robots.txt index 3e78ed8..2e1d1eb 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -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 }} \ No newline at end of file +{{ end }}