From 0715006f893e9208775d505512175274b001fb84 Mon Sep 17 00:00:00 2001 From: John Hollowell Date: Mon, 4 May 2020 20:09:33 -0400 Subject: Allow Google Analytics to only track production site prevents loading the google analytics internal partial unless the system is in "production" mode `hugo` defaults to "production". * Any command can add `--environment production` to the hugo command * OR add HUGO_ENVIRONMENT="production" to the shell running hugo --- layouts/partials/head.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index e2b6a5a..1e7e079 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -17,6 +17,9 @@ {{ $style := resources.Get "css/ace.scss" | toCSS | minify }} - {{ template "_internal/google_analytics_async.html" . }} + + {{ if eq hugo.Environment "production" }} + {{ template "_internal/google_analytics_async.html" . }} + {{ end }} -- cgit v1.2.3