diff options
author | Joe Mooring <joe.mooring@veriphor.com> | 2023-10-16 11:31:09 -0700 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-10-17 20:06:42 +0200 |
commit | a692278bc679af44f69cc49c11efc412edd979a0 (patch) | |
tree | 40b99ffea484db49f3e30a04b1cc71aaef3722b4 /tpl | |
parent | d4016dd5cd57a27f19a5472c6031d156066860b7 (diff) |
hugolib: Deprecate .Site.GoogleAnalytics
Use .Site.Config.Services.GoogleAnalytics.ID instead.
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/tplimpl/embedded/templates/google_analytics.html | 4 | ||||
-rw-r--r-- | tpl/tplimpl/embedded/templates/google_analytics_async.html | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tpl/tplimpl/embedded/templates/google_analytics.html b/tpl/tplimpl/embedded/templates/google_analytics.html index f518b150c..ad88ae924 100644 --- a/tpl/tplimpl/embedded/templates/google_analytics.html +++ b/tpl/tplimpl/embedded/templates/google_analytics.html @@ -1,5 +1,5 @@ {{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} -{{- if not $pc.Disable }}{{ with .Site.GoogleAnalytics -}} +{{- if not $pc.Disable }}{{ with .Site.Config.Services.GoogleAnalytics.ID -}} {{ if hasPrefix . "G-"}} <script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script> <script> @@ -48,4 +48,4 @@ var doNotTrack = false; var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack); var doNotTrack = (dnt == "1" || dnt == "yes"); {{- end -}} -{{- end -}}
\ No newline at end of file +{{- end -}} diff --git a/tpl/tplimpl/embedded/templates/google_analytics_async.html b/tpl/tplimpl/embedded/templates/google_analytics_async.html index b7bf36faa..c9ba8a2b3 100644 --- a/tpl/tplimpl/embedded/templates/google_analytics_async.html +++ b/tpl/tplimpl/embedded/templates/google_analytics_async.html @@ -1,7 +1,7 @@ {{ warnf "_internal/google_analytics_async.html is no longer supported by Google and will be removed in a future version of Hugo" }} {{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} {{- if not $pc.Disable -}} -{{ with .Site.GoogleAnalytics }} +{{ with .Site.Config.Services.GoogleAnalytics.ID }} <script type="application/javascript"> {{ template "__ga_js_set_doNotTrack" $ }} if (!doNotTrack) { |