diff options
-rw-r--r-- | layouts/_default/baseof.html | 3 | ||||
-rw-r--r-- | layouts/partials/google-analytics-async.html | 10 | ||||
-rw-r--r-- | layouts/partials/head.html | 6 |
3 files changed, 6 insertions, 13 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 40335dc..8b3705f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -7,7 +7,6 @@ <main> {{ block "main" . }}{{ end }} </main> - {{ partial "google-analytics-async.html" . }} </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/layouts/partials/google-analytics-async.html b/layouts/partials/google-analytics-async.html deleted file mode 100644 index ecc2767..0000000 --- a/layouts/partials/google-analytics-async.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ if not .Site.IsServer }} - {{ with .Site.GoogleAnalytics }} - <script> - window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; - ga('create', '{{ . }}', 'auto'); - ga('send', 'pageview'); - </script> - <script async src='https://www.google-analytics.com/analytics.js'></script> - {{ end }} -{{ end }}
\ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 68540ee..009893f 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -29,10 +29,14 @@ {{ $customCssPath := "css/custom.css" }} {{ $customCss:= resources.Get $customCssPath | resources.ExecuteAsTemplate $customCssPath . }} <link rel="stylesheet" type="text/css" href="{{ $customCss.RelPermalink }}"> + + {{ if hugo.IsProduction }} + {{ template "_internal/google_analytics.html" . }} + {{ end }} {{ $title := print .Title " | " .Site.Title }} {{ if .IsHome }} {{ $title = .Site.Title }} {{ end }} <title>{{ $title }}</title> -</head>
\ No newline at end of file +</head> |