From 600514bbc5979dfdf9306551822a35212357e022 Mon Sep 17 00:00:00 2001 From: somrat sorkar Date: Mon, 24 Jul 2023 09:16:53 +0600 Subject: [PATCH] update google-analytics --- exampleSite/hugo.toml | 2 +- layouts/partials/essentials/head.html | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml index 57687c0..abeda7a 100755 --- a/exampleSite/hugo.toml +++ b/exampleSite/hugo.toml @@ -12,7 +12,7 @@ paginate = 2 # see https://gohugo.io/extras/pagination/ # post excerpt summaryLength = 10 # see https://gohugo.io/content-management/excerpts/ # google analytics -googleAnalytics = "UA-123456-78" # example: UA-123456-78, for more info, read the article https://support.google.com/analytics/answer/1008080?hl=en +googleAnalytics = "G-MEASUREMENT_ID" # see https://gohugo.io/templates/internal/#configure-google-analytics # disqus short name disqusShortname = "themefisher-template" # we use disqus to show comments in blog posts . To install disqus please follow this tutorial https://portfolio.peter-baumgartner.net/2017/09/10/how-to-install-disqus-on-hugo/ # disable language diff --git a/layouts/partials/essentials/head.html b/layouts/partials/essentials/head.html index 073cacc..1eb929a 100755 --- a/layouts/partials/essentials/head.html +++ b/layouts/partials/essentials/head.html @@ -30,7 +30,9 @@ -{{ template "_internal/google_analytics.html" . }} +{{ if and site.Config.Services.GoogleAnalytics.ID (ne site.Config.Services.GoogleAnalytics.ID "G-MEASUREMENT_ID") }} + {{ template "_internal/google_analytics.html" . }} +{{ end }}