* feat: add GDPR cookie consent banner
Add a GDPR-compliant cookie consent banner that gates analytics (Google
Analytics) and functional cookies (comments) until user consent is given.
Features:
- Theme-consistent styling using CSS variables (light/dark mode)
- Settings panel with category toggles (necessary, analytics, functional)
- Consent stored in cookie for 365 days
- Google Analytics only loads after analytics consent
- Comments only load after functional consent
- Translations for all 32 supported languages
- Accessible with proper ARIA attributes and focus management
Configuration in hugo.yaml:
params:
cookies:
enabled: true
categories:
analytics: true
functional: true
When cookies.enabled is false, scripts load normally without consent gating.
Closes #412
* refactor: move consent-gated GA to cookies/analytics.html
Move Google Analytics consent logic to avoid shadowing Hugo's internal
`_internal/google_analytics.html` template.
Changes:
- Rename google_analytics.html → cookies/analytics.html
- Update head.html to conditionally load:
- cookies.enabled=true: cookies/analytics.html (consent-gated)
- cookies.enabled=false: Hugo's _internal/google_analytics.html
- Align cookies/analytics.html with Hugo's internal template:
- Support Privacy.GoogleAnalytics.Disable setting
- Support Privacy.GoogleAnalytics.RespectDoNotTrack setting
- Add UA- prefix deprecation warning
Note: Custom JS is required for consent-gated GA because Hugo templates
render at build time, but consent happens at runtime. We cannot call
Hugo's internal template after the user grants consent - we must
dynamically inject the GA script via JavaScript.
* style: indent cookies/analytics.html
* refactor: don't use default, put default configurations in params.toml
* fix: don't use `description` as translation key because it's reserved and will throw error
* fix: remove footer/components/custom-font.html call
* fix: banner showSettings key
* style: indent comments/include
* Add missing article.alert translation back
* style: format i18n toml files
* style: indent head/head.html
* style adjustment
* style: add missing -
* style: format demo/config/params.toml
* style: remove redundant comments from cookies.scss
* style: update box-shadow for cookie banner content
---------
Co-authored-by: delize <4028612+delize@users.noreply.github.com>
Co-authored-by: Jimmy Cai <jimmy@cai.im>
90 lines
2.7 KiB
TOML
90 lines
2.7 KiB
TOML
toggleMenu = "Przełącz Menu"
|
|
darkMode = "Tryb ciemny"
|
|
|
|
[list]
|
|
section = "Sekcja"
|
|
|
|
[list.page]
|
|
one = "{{ .Count }} strona"
|
|
few = "{{ .Count }} strony"
|
|
many = "{{ .Count }} stron"
|
|
other = "{{ .Count }} stron"
|
|
|
|
[list.subsection]
|
|
one = "Podsekcja"
|
|
few = "Podsekcje"
|
|
many = "Podsekcji"
|
|
other = "Podsekcji"
|
|
|
|
[article]
|
|
back = "Wróć"
|
|
tableOfContents = "Spis treści"
|
|
relatedContent = "Powiązane artykuły"
|
|
lastUpdatedOn = "Ostatnio zaktualizowany"
|
|
|
|
[article.readingTime]
|
|
one = "Przeczytasz w {{ .Count }} minutę"
|
|
few = "Przeczytasz w {{ .Count }} minuty"
|
|
many = "Przeczytasz w {{ .Count }} minut"
|
|
other = "Przeczytasz w {{ .Count }} minut"
|
|
|
|
[article.alert]
|
|
note = "Notatka"
|
|
tip = "Wskazówka"
|
|
important = "Ważne"
|
|
warning = "Ostrzeżenie"
|
|
caution = "Uwaga"
|
|
|
|
[notFound]
|
|
title = "Nie znaleziono"
|
|
subtitle = "Ta strona nie istnieje"
|
|
|
|
[widget]
|
|
[widget.archives]
|
|
title = "Archiwum"
|
|
more = "Więcej"
|
|
|
|
[widget.tagCloud]
|
|
title = "Tagi"
|
|
|
|
[widget.categoriesCloud]
|
|
title = "Kategorie"
|
|
|
|
[search]
|
|
title = "Szukaj"
|
|
placeholder = "Wpisz coś..."
|
|
|
|
[search.resultTitle]
|
|
one = "#PAGES_COUNT strona (#TIME_SECONDS sekund)"
|
|
few = "#PAGES_COUNT strony (#TIME_SECONDS sekund)"
|
|
many = "#PAGES_COUNT stron (#TIME_SECONDS sekund)"
|
|
other = "#PAGES_COUNT stron (#TIME_SECONDS sekund)"
|
|
|
|
[footer]
|
|
builtWith = "Zbudowano z {{ .Generator }}"
|
|
designedBy = "Motyw {{ .Theme }} zaprojektowany przez {{ .DesignedBy }}"
|
|
|
|
[cookies]
|
|
title = "Zgoda na pliki cookie"
|
|
text = "Używamy plików cookie, aby poprawić Twoje wrażenia z przeglądania i analizować ruch w witrynie."
|
|
acceptAll = "Akceptuj wszystkie"
|
|
deny = "Odrzuć"
|
|
managePreferences = "Zarządzaj preferencjami"
|
|
settingsTitle = "Preferencje plików cookie"
|
|
savePreferences = "Zapisz preferencje"
|
|
cancel = "Anuluj"
|
|
footerLink = "Ustawienia plików cookie"
|
|
commentsDisabled = "Komentarze są wyłączone, dopóki nie zaakceptujesz funkcjonalnych plików cookie."
|
|
|
|
[cookies.necessary]
|
|
title = "Niezbędne"
|
|
text = "Te pliki cookie są wymagane do działania witryny i nie można ich wyłączyć."
|
|
|
|
[cookies.analytics]
|
|
title = "Analityczne"
|
|
text = "Te pliki cookie pomagają nam zrozumieć, jak odwiedzający wchodzą w interakcję z naszą witryną."
|
|
|
|
[cookies.functional]
|
|
title = "Funkcjonalne"
|
|
text = "Te pliki cookie włączają funkcje takie jak komentarze i osadzone treści."
|