diff options
author | jbub <juraj.bubniak@gmail.com> | 2018-05-28 14:05:07 +0300 |
---|---|---|
committer | jbub <juraj.bubniak@gmail.com> | 2018-05-28 14:05:07 +0300 |
commit | 2340a01fea08ecfff62ee22551741180862156ce (patch) | |
tree | 01d3d7ae3643742c6215c2a26b835a459c36bd86 | |
parent | 5b9400c068441b76d65c8855442d44b78b2f7108 (diff) |
Implement hugo privacy config, set version 0.41.
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | exampleSite/config.toml | 12 | ||||
-rw-r--r-- | layouts/partials/google_analytics.html | 25 | ||||
-rw-r--r-- | layouts/partials/header.html | 2 | ||||
-rw-r--r-- | theme.toml | 2 |
5 files changed, 22 insertions, 31 deletions
@@ -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 }} -<script> - {{ template "__ga_js_set_doNotTrack" $ }} - if (!doNotTrack) { - (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','https://www.google-analytics.com/analytics.js','ga'); - ga('create', '{{ .Site.GoogleAnalytics }}', 'auto'); -{{- if .Site.Params.googleAnalyticsAnonymizeIP }} - ga('set', 'anonymizeIp', true); -{{- end }} - ga('send', 'pageview'); - } -</script> -{{ 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" . }} </head> <body> - {{ partial "google_analytics.html" . }} + {{ template "_internal/google_analytics.html" . }} <div id="wrapper"> <header class="site-header"> @@ -5,7 +5,7 @@ description = "A fork of simple AJAX driven theme for the Ghost blogging platfor homepage = "https://github.com/jbub/ghostwriter" tags = ["blog", "technical", "personal"] features = ["blog", "technical", "personal"] -min_version = 0.37 +min_version = "0.41" [author] name = "Juraj Bubniak" |