From d8bc79ad2dfb4d70bfe64fa2f349398073b1b0a2 Mon Sep 17 00:00:00 2001 From: Frank Blechschmidt Date: Mon, 22 May 2023 15:58:05 -0700 Subject: Add support for cookie consent and with GA4 --- layouts/_default/baseof.html | 4 + layouts/partials/consent.html | 170 ++++++++++++++++++++++++++++++++++ layouts/partials/googleanalytics.html | 18 ++++ layouts/partials/head.html | 22 ++--- 4 files changed, 202 insertions(+), 12 deletions(-) create mode 100644 layouts/partials/consent.html create mode 100644 layouts/partials/googleanalytics.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 237c540..18ea882 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -10,5 +10,9 @@ {{- block "main" . }}{{- end }} {{- partial "footer.html" . -}} + + {{ if not .Site.IsServer }} + {{- partial "consent.html" . -}} + {{ end }} diff --git a/layouts/partials/consent.html b/layouts/partials/consent.html new file mode 100644 index 0000000..2f9181d --- /dev/null +++ b/layouts/partials/consent.html @@ -0,0 +1,170 @@ +{{/* Based on https://hugocodex.org/add-ons/cookie-consent/ */}} + + + + + + +{{ range $index, $item := .Site.Data.consent.items }} + {{ if $item.is_functional }} + + {{ end }} +{{ end }} diff --git a/layouts/partials/googleanalytics.html b/layouts/partials/googleanalytics.html new file mode 100644 index 0000000..2d72d71 --- /dev/null +++ b/layouts/partials/googleanalytics.html @@ -0,0 +1,18 @@ +{{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} +{{- if not $pc.Disable }}{{ with .Site.GoogleAnalytics -}} + +{{- end -}} +{{- end -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index f01e36b..f658d68 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -10,23 +10,21 @@ - - {{ $style := resources.Get "sass/researcher.scss" | resources.ExecuteAsTemplate "sass/researcher.scss" . | toCSS | minify }} + {{ $style := resources.Get "sass/researcher.scss" | resources.ExecuteAsTemplate "sass/researcher.scss" . | toCSS | minify -}} - - {{ with .Site.Params.favicon }} - - {{ end }} + {{ with .Site.Params.favicon -}} + + {{ end -}} {{ with .OutputFormats.Get "rss" -}} {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} - {{ if not .Site.IsServer }} - {{ template "_internal/google_analytics.html" . }} - {{ end }} + {{- if not .Site.IsServer -}} + {{- partial "googleanalytics.html" . -}} + {{- end -}} - {{ if .Params.noindex }} - - {{ end }} + {{ if .Params.noindex -}} + + {{ end -}} -- cgit v1.2.3 From cf7789dbc3ebfdac3365a72a1eca2b7efeca916b Mon Sep 17 00:00:00 2001 From: Frank Blechschmidt Date: Mon, 22 May 2023 22:53:40 -0700 Subject: Add possibility to open footer link in new tab --- layouts/partials/footer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index b027256..9cc8e31 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -9,7 +9,7 @@ {{ end }} {{ with .Site.Params.footer }} {{ end }} -- cgit v1.2.3 From 602e533fb26a941078db16921e8400853ba94d30 Mon Sep 17 00:00:00 2001 From: Frank Blechschmidt Date: Mon, 22 May 2023 23:20:00 -0700 Subject: Upgrade dependencies and consolidate CDN --- layouts/partials/head.html | 6 +++--- layouts/partials/math.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index f658d68..88ba7ea 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -7,9 +7,9 @@ - - - + + + {{ $style := resources.Get "sass/researcher.scss" | resources.ExecuteAsTemplate "sass/researcher.scss" . | toCSS | minify -}} {{ with .Site.Params.favicon -}} diff --git a/layouts/partials/math.html b/layouts/partials/math.html index 19c0502..c45386b 100644 --- a/layouts/partials/math.html +++ b/layouts/partials/math.html @@ -1,6 +1,6 @@ - - - + + +