diff --git a/assets/css/common/main.css b/assets/css/common/main.css index 50022ac1..6aca8a69 100644 --- a/assets/css/common/main.css +++ b/assets/css/common/main.css @@ -66,3 +66,49 @@ div.highlight:hover .copy-code, pre:hover .copy-code { display: block; } + +#cookie-notice { + font-size: medium; + padding: 0.5rem 1rem; + display: none; + text-align: center; + position: fixed; + bottom: 0; + left: 20px; + padding-top: 15; + padding-bottom: 10px; + width: 100%; + background: rgb(70, 70, 70); + color: rgba(255,255,255,0.8); +} + +#cookie-notice a { + font-weight: 600; + display: inline-flex; + cursor: pointer; + margin-left: 0.5rem; +} + +#cookie-notice-accept { + color:rgb(86, 228, 58); +} + +#cookie-notice-deny { + color:rgb(243, 34, 34); +} + +@media (max-width: 767px) { + #cookie-notice span { + display: block; + padding-top: 3px; + margin-bottom: 1rem; + } + #cookie-notice a { + position: relative; + bottom: 4px; + } + #cookie-notice { + left: 0px; + } +} + \ No newline at end of file diff --git a/i18n/it.yaml b/i18n/it.yaml index ef41db4e..b81d85b3 100644 --- a/i18n/it.yaml +++ b/i18n/it.yaml @@ -25,3 +25,15 @@ - id: code_copied translation: "copiato!" + +- id: cookie_approve + translation: "Accetta" + +- id: cookie_deny + translation: "Rifiuta" + +- id: cookie_more_info + translation: "Più Info" + +- id: cookie_message + translation: "Vorrei utilizzare cookie e script di terze parti per migliorare la funzionalità di questo sito web." \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 35257fc7..b704d95c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -163,7 +163,11 @@ {{- /* Misc */}} {{- if hugo.IsProduction | or (eq site.Params.env "production") }} +{{- if eq .Site.Params.cookieEnabled true }} +{{- template "partials/templates/cookie-consent.html" . }} +{{- else }} {{- template "_internal/google_analytics.html" . }} +{{- end -}} {{- template "partials/templates/opengraph.html" . }} {{- template "partials/templates/twitter_cards.html" . }} {{- template "partials/templates/schema_json.html" . }} diff --git a/layouts/partials/templates/cookie-consent.html b/layouts/partials/templates/cookie-consent.html new file mode 100644 index 00000000..6d79f3a2 --- /dev/null +++ b/layouts/partials/templates/cookie-consent.html @@ -0,0 +1,75 @@ + + + \ No newline at end of file