Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mismith0227/hugo_theme_pickles.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormisumi <mismith0227@users.noreply.github.com>2020-03-04 02:21:40 +0300
committerGitHub <noreply@github.com>2020-03-04 02:21:40 +0300
commitc5d506cb296433a29cd1770304ab2b7b274b1b83 (patch)
treedab54c20c0f5571e99db4d3c1fd245ad5d18bfaf /layouts
parent93723751d76311a334acd49a8e5c2571bdd3873c (diff)
parent994e82f190fe7cbdc5e48bad710599a6255174ac (diff)
Merge pull request #138 from mewa/use-standard-ga
Use standard Hugo template for Google Analytics
Diffstat (limited to 'layouts')
-rwxr-xr-xlayouts/partials/footer.html13
-rw-r--r--layouts/partials/head.html4
2 files changed, 4 insertions, 13 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index e4efdc0..a3487f9 100755
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -25,19 +25,6 @@
</p>
</footer>
- {{ if not .Site.IsServer }}
- {{ with ($.Param "ga_api_key") }}
- <script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
- ga('create', '{{ . }}', 'auto');
- ga('send', 'pageview');
- </script>
- {{ end }}
- {{ end }}
-
{{- partial "footer_custom.html" . }}
</body>
</html>
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 1bdc9db..ecec8cd 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -38,6 +38,10 @@
{{ end }}
<!-- Hugo Version Number -->
{{ hugo.Generator -}}
+
+ {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
+ {{ template "_internal/google_analytics_async.html" . }}
+ {{ end }}
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css" />
<!-- Custom css files as define in config.toml -->