Cookie concent feature.

This commit is contained in:
Fredrik Jonsson 2021-01-29 14:53:38 +01:00
commit 79b366cb18
3 changed files with 236 additions and 6 deletions

View file

@ -36,6 +36,7 @@
{{ with $.Param "footer" }}<p>{{ . | markdownify }}</p>{{ end }}
{{ if $.Param "poweredby" }}<p>Powered by <a href="https://gohugo.io/">Hugo</a> and the <a href="https://github.com/frjo/hugo-theme-zen">Zen theme</a>.</p>{{ end }}
</footer>
{{ if $.Param "cookieconsent" }}{{ partial "cookieconsent.html" . }}{{ end -}}
</div>
{{ if $.Param "mobilemenu" }}{{ partial "mobilemenu.html" . }}{{ end -}}

View file

@ -0,0 +1,10 @@
<div class="cookieconsent layout__cookieconsent">
<div class="cookieconsent__message">
{{ i18n "cookieconsent_message" }}
{{ with .Site.Params.privacyPolicyUrl }}<a href="{{ . }}">{{ i18n "privacy_policy" }}</a>{{ end }}
</div>
<div class="cookieconsent__actions">
<button class="button button--small button--cookieconsent button--decline" type="button" data-consent="false">{{ i18n "cookieconsent_decline" }}</button>
<button class="button button--small button--cookieconsent button--accept" type="button" data-consent="true">{{ i18n "cookieconsent_accept" }}</button>
</div>
</div>

View file

@ -10,6 +10,12 @@
{{ $mobilemenu := resources.Get "js/mobile.js" | minify | fingerprint -}}
<script defer src="{{ $mobilemenu.RelPermalink }}"></script>
{{ end -}}
{{ if $.Param "cookieconsent" -}}
{{ $jscookie := resources.Get "js/lib/js.cookie.min.js" | fingerprint -}}
<script src="{{ $jscookie.RelPermalink }}"></script>
{{ $cookieconsent := resources.Get "js/cookieconsent.js" | minify | fingerprint -}}
<script defer src="{{ $cookieconsent.RelPermalink }}"></script>
{{ end -}}
{{ if .HasShortcode "contact" -}}
{{ $contact := resources.Get "js/contact.js" | minify | fingerprint -}}
<script defer src="{{ $contact.RelPermalink }}"></script>