Skip to content

Commit

Permalink
feat(scripts): only enable google analytics in production environment (
Browse files Browse the repository at this point in the history
…olOwOlo#260)

Should set env to production, e.g.: `hugo serve -e production`

Default environments are **development** with `hugo serve` and **production** with `hugo`.
  • Loading branch information
panda-z authored May 12, 2020
1 parent bb826d8 commit c77d782
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
{{- end }}

<!-- Analytics -->
{{- if and (not .Site.IsServer) .Site.GoogleAnalytics -}}
{{- if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics_async.html" . }}
{{- end -}}

Expand Down

0 comments on commit c77d782

Please sign in to comment.