As in the title, it would be a good thing to disable GoogleAnalytics when not running in production.
There are several ways to do this but the one i prefer is to check for the env var HUGO_ENV.
Here user budparr suggests this code:
{{ if eq (getenv "HUGO_ENV") "production" }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
You should simply change layouts/partials/head.html. I would do a pull request but since there are many ways to disable it and since that would force your user to provide that env var, i prefer you to solve the issue in the way you prefer
As in the title, it would be a good thing to disable GoogleAnalytics when not running in production. There are several ways to do this but the one i prefer is to check for the env var HUGO_ENV. Here user budparr suggests this code:
You should simply change layouts/partials/head.html. I would do a pull request but since there are many ways to disable it and since that would force your user to provide that env var, i prefer you to solve the issue in the way you prefer