From 7dea1cfdf867626125ec8394ee5671cfd14f6a73 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Wed, 30 Oct 2019 13:20:25 +0000 Subject: [PATCH] feat: recognize env via -e argument in addition to HUGO_ENV Also, see https://github.com/gohugoio/hugo/issues/6456#issuecomment-546524056 --- layouts/partials/marketing/google_analytics.html | 2 +- layouts/partials/marketing/google_tag_manager.html | 2 +- layouts/partials/site_head.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layouts/partials/marketing/google_analytics.html b/layouts/partials/marketing/google_analytics.html index e504b603..d870fd5f 100644 --- a/layouts/partials/marketing/google_analytics.html +++ b/layouts/partials/marketing/google_analytics.html @@ -1,7 +1,7 @@ {{ $ga := site.Params.marketing.google_analytics | default site.GoogleAnalytics | default "" }} {{ $gtm := site.Params.marketing.google_tag_manager | default "" }} -{{ if eq (getenv "HUGO_ENV") "production" | and $ga | and (not $gtm) }} +{{ if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and $ga | and (not $gtm) }} {{ $gtag_config := cond site.Params.privacy_pack "{ 'anonymize_ip': true }" "{}" }} diff --git a/layouts/partials/marketing/google_tag_manager.html b/layouts/partials/marketing/google_tag_manager.html index 1da839ab..6ae3abc6 100644 --- a/layouts/partials/marketing/google_tag_manager.html +++ b/layouts/partials/marketing/google_tag_manager.html @@ -1,4 +1,4 @@ -{{ if eq (getenv "HUGO_ENV") "production" | and site.Params.marketing.google_tag_manager }} +{{ if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and site.Params.marketing.google_tag_manager }}