From 2340a01fea08ecfff62ee22551741180862156ce Mon Sep 17 00:00:00 2001 From: jbub Date: Mon, 28 May 2018 13:05:07 +0200 Subject: Implement hugo privacy config, set version 0.41. --- README.md | 12 ++++++++++-- exampleSite/config.toml | 12 ++++++++++-- layouts/partials/google_analytics.html | 25 ------------------------- layouts/partials/header.html | 2 +- theme.toml | 2 +- 5 files changed, 22 insertions(+), 31 deletions(-) delete mode 100644 layouts/partials/google_analytics.html diff --git a/README.md b/README.md index 5c01116..73aad5c 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,16 @@ copyright = "My Name" googleAnalytics = "XXX" disqusShortname = "XXX" +[Privacy] + +[Privacy.disqus] + disable = true + +[Privacy.googleAnalytics] + anonymizeIP = true + respectDoNotTrack = true + useSessionStorage = false + [Author] name = "My Name" profile = "https://google.com/+XXX" @@ -72,8 +82,6 @@ disqusShortname = "XXX" dateFormat = "Mon, Jan 2, 2006" highlightJsUrl = "" highlightJsLocalUrl = "" - googleAnalyticsAnonymizeIP = false - googleAnalyticsRespectDoNotTrack = false [Permalinks] post = "/:year/:month/:day/:filename/" diff --git a/exampleSite/config.toml b/exampleSite/config.toml index f6d8efe..5b0c218 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -6,6 +6,16 @@ copyright = "My Name" disqusShortname = "XXX" googleAnalytics = "XXX" +[Privacy] + +[Privacy.disqus] + disable = true + +[Privacy.googleAnalytics] + anonymizeIP = true + respectDoNotTrack = true + useSessionStorage = false + [Author] name = "My Name" profile = "https://google.com/+XXX" @@ -32,8 +42,6 @@ googleAnalytics = "XXX" dateFormat = "Mon, Jan 2, 2006" highlightJsUrl = "" highlightJsLocalUrl = "" - googleAnalyticsAnonymizeIP = false - googleAnalyticsRespectDoNotTrack = false [Permalinks] post = "/:year/:month/:day/:filename/" diff --git a/layouts/partials/google_analytics.html b/layouts/partials/google_analytics.html deleted file mode 100644 index 964a396..0000000 --- a/layouts/partials/google_analytics.html +++ /dev/null @@ -1,25 +0,0 @@ -{{ if .Site.GoogleAnalytics }} - -{{ end }} - -{{- define "__ga_js_set_doNotTrack" -}} - {{- if not .Site.Params.googleAnalyticsRespectDoNotTrack -}} - var doNotTrack = false; - {{- else -}} - var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack); - var doNotTrack = (dnt == "1" || dnt == "yes"); - {{- end -}} -{{- end -}} \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 1daf361..8ddb315 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -20,7 +20,7 @@ {{ partial "extra-in-head.html" . }} - {{ partial "google_analytics.html" . }} + {{ template "_internal/google_analytics.html" . }}