|
|
@@ -1,4 +1,4 @@
|
|
|
|
# hugo-cookie-consent
|
|
|
|
# hugo_cookie_consent
|
|
|
|
|
|
|
|
|
|
|
|
**Hugo module that implements a cookie-consent message and functionality to change
|
|
|
|
**Hugo module that implements a cookie-consent message and functionality to change
|
|
|
|
the cookie-consent decision.**
|
|
|
|
the cookie-consent decision.**
|
|
|
@@ -33,7 +33,7 @@ structure with `_partials` and `_shortcode` directories with leading underscores
|
|
|
|
# config/_default/hugo.yaml
|
|
|
|
# config/_default/hugo.yaml
|
|
|
|
module:
|
|
|
|
module:
|
|
|
|
imports:
|
|
|
|
imports:
|
|
|
|
- path: git.bovender.de/daniel/hugo-cookie-consent
|
|
|
|
- path: git.bovender.de/daniel/hugo_cookie_consent
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
3. Add configuration keys (see [below](#configuration)).
|
|
|
|
3. Add configuration keys (see [below](#configuration)).
|
|
|
@@ -41,42 +41,49 @@ structure with `_partials` and `_shortcode` directories with leading underscores
|
|
|
|
4. If your site's language is neither English nor German, add a few terms in the
|
|
|
|
4. If your site's language is neither English nor German, add a few terms in the
|
|
|
|
desired language to the language tables.
|
|
|
|
desired language to the language tables.
|
|
|
|
|
|
|
|
|
|
|
|
5. Make your pages load the JavaScript code, e. g. by adding this to a `script.html`
|
|
|
|
5. Make your pages load the JavaScript code, e. g. by adding this partial to your
|
|
|
|
partial:
|
|
|
|
`baseof.html` template:
|
|
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
```html
|
|
|
|
{{- $js := resources.Get "js/cookie-consent.js" | minify -}}
|
|
|
|
{{ partial "hugo_cookie_consent/scripts.html" }}
|
|
|
|
<script src="{{ $js.RelPermalink }}" defer></script>
|
|
|
|
|
|
|
|
{{- $js := resources.Get "js/tracker-code.js" | minify -}}
|
|
|
|
|
|
|
|
<script src="{{ $js.RelPermalink }}" defer></script>
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
6. Optionally, insert a `cookie-settings` partial somewhere on your site to enable
|
|
|
|
6. Ensure that the SCSS style sheet is being loaded, e.g. by adding this line to
|
|
|
|
visitors to review and revise their choice. The privacy statement page might
|
|
|
|
your main *.css file:
|
|
|
|
be a good place for this.
|
|
|
|
|
|
|
|
|
|
|
|
```scss
|
|
|
|
|
|
|
|
@import "hugo_cookie_consent/style";
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7. Optionally, insert a `hugo_cookie_consent/settings` partial somewhere on your
|
|
|
|
|
|
|
|
site to enable visitors to review and revise their choice. The privacy
|
|
|
|
|
|
|
|
statement page might be a good place for this.
|
|
|
|
|
|
|
|
|
|
|
|
```md
|
|
|
|
```md
|
|
|
|
{{< cookie-settings >}}
|
|
|
|
{{< hugo_cookie_consent/settings >}}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
|
|
|
|
You can configure the module by defining site parameters in your
|
|
|
|
You can configure the module by defining site parameters in your site
|
|
|
|
`hugo.yaml` or `hugo.toml` configuration file. The following
|
|
|
|
configuration. The following snippet shows the content of the default
|
|
|
|
snippet shows the default values.
|
|
|
|
`params.yaml` which you may override as needed.
|
|
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
```yaml
|
|
|
|
# config/_default/params.yaml
|
|
|
|
# config/_default/params.yaml
|
|
|
|
hugo_cookie_consent:
|
|
|
|
hugo_cookie_consent:
|
|
|
|
privacy_policy_url:
|
|
|
|
privacy_policy_url:
|
|
|
|
enable_matomo: false
|
|
|
|
enable_tracking: false
|
|
|
|
matomo_host:
|
|
|
|
matomo_host:
|
|
|
|
matomo_site_id:
|
|
|
|
matomo_site_id:
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
| Parameter | Description |
|
|
|
|
| Parameter | Description |
|
|
|
|
|-----------|-------------|
|
|
|
|
|----------------------|--------------------------------------------|
|
|
|
|
| `privacy_policy_url` | URL of the privacy policy page
|
|
|
|
| `privacy_policy_url` | URL of the privacy policy page |
|
|
|
|
|
|
|
|
| `enable_tracking` | Whether to include the tracking script |
|
|
|
|
|
|
|
|
| `matomo_host` | URL of the Matomo host. |
|
|
|
|
|
|
|
|
| `matomo_site_id` | Matomo site ID to use for tracking. |
|
|
|
|
|
|
|
|
|
|
|
|
[anthropic claude]: https://claude.ai
|
|
|
|
[anthropic claude]: https://claude.ai
|
|
|
|
[gdpr]: https://en.wikipedia.org/wiki/GDPR
|
|
|
|
[gdpr]: https://en.wikipedia.org/wiki/GDPR
|
|
|
|