diff options
author | Mike Bergeron <shortword@users.noreply.github.com> | 2018-07-04 15:29:28 +0300 |
---|---|---|
committer | Curtis Timson <curt@live.co.uk> | 2018-07-04 15:29:28 +0300 |
commit | 10125d8fe1dae8b95ba3df96c419a369fac3eac5 (patch) | |
tree | 1003b724134796b2d95128664340ab48dec8d3b3 /layouts | |
parent | 48582c4870a5fc4ff811b2b50ee938365a2d6d21 (diff) |
Use Hugo's internal templates for Google Analytics (GA) (#36)3.0.0
* Use Hugo's internal templates for Google Analytics (GA)
This commit does the following:
* Removes a hardcoded Google Analytics ID
* Converts the layout to use Hugo's internal GA teamplate
* Removes the configuration items from the example site
* Adds a section to the README about what internal templates are
supported.
For more info about the GA internal template, see this URL:
https://gohugo.io/templates/internal/#configure-google-analytics
Signed-off-by: Michael Bergeron <mikeb.code@gmail.com>
* Add Google Analytics config into exampleSite
* Add google analytics template to single.html
* Bump version to 3.0.0
Breaking change based on google analytics configuration
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/single.html | 3 | ||||
-rw-r--r-- | layouts/index.html | 1 | ||||
-rw-r--r-- | layouts/partials/scripts/googleanalytics.html | 11 | ||||
-rw-r--r-- | layouts/partials/scripts/index.html | 1 |
4 files changed, 3 insertions, 13 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index f1b3f27..5860e0b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -36,7 +36,8 @@ {{ partial "footer/index" . }} {{ partial "copyright" . }} - </div> + </div> + {{ template "_internal/google_analytics.html" . }} {{ partial "scripts/index" . }} </body> </html> diff --git a/layouts/index.html b/layouts/index.html index b45fb1c..ae90e4d 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -60,6 +60,7 @@ {{ partial "copyright" . }} </div> + {{ template "_internal/google_analytics.html" . }} {{ partial "scripts/index" . }} </body> diff --git a/layouts/partials/scripts/googleanalytics.html b/layouts/partials/scripts/googleanalytics.html deleted file mode 100644 index 98a3c47..0000000 --- a/layouts/partials/scripts/googleanalytics.html +++ /dev/null @@ -1,11 +0,0 @@ -{{ if .Site.Params.Settings.googleanalytics }} -<!-- Global site tag (gtag.js) - Google Analytics --> -<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113904582-1"></script> -<script> - window.dataLayer = window.dataLayer || []; - function gtag(){dataLayer.push(arguments);} - gtag('js', new Date()); - - gtag('config', {{ .Site.Params.Settings.googleanalytics }}); -</script> -{{ end }}
\ No newline at end of file diff --git a/layouts/partials/scripts/index.html b/layouts/partials/scripts/index.html index 92c8ed9..2c4ef29 100644 --- a/layouts/partials/scripts/index.html +++ b/layouts/partials/scripts/index.html @@ -6,5 +6,4 @@ <script src='{{ "assets/js/util.js" | relURL }}'></script> <script src='{{ "assets/js/main.js" | relURL }}'></script> -{{ partial "scripts/googleanalytics" . }} {{ partial "scripts/disqus" . }} |