1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-12-21 10:02:17 +01:00
hugo-theme-bootstrap4-blog/layouts/partials/cookie-consent.html
Alan Orth 233e715e78
layouts: fix some deprecations
Fix these errors from Hugo:

    ERROR deprecated: .Site.GoogleAnalytics was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.134.0. Use .Site.Config.Services.GoogleAnalytics.ID instead.
    ERROR deprecated: .Site.DisqusShortname was deprecated in Hugo v0.120.0 and will be removed in Hugo 0.134.0. Use .Site.Config.Services.Disqus.Shortname instead.
2024-09-17 08:00:11 +04:00

41 lines
1.2 KiB
HTML

{{ $cookieConsentScript := resources.Get "js/haven.umd.min.js" | resources.Fingerprint }}
<script src="{{ $cookieConsentScript.Permalink }}"{{ if not .Site.Params.disable_sri }} integrity="{{ $cookieConsentScript.Data.Integrity }}" crossorigin="anonymous"{{ end }}></script>
<script>
Haven.create({
notification: {
{{ with .Site.Params.cookie_consent_info_url -}}
policyUrl: {{ . | absURL }},
{{- end }}
styles: {
background: '#428bca',
textColor: '#ffffff',
buttonBackgroundColor: '#f71559',
buttonTextColor: '#ffffff',
},
},
translations: {
{{ .Lang }}: {
notification: {
policy: '{{ i18n "cookieLink" }}',
message: '{{ i18n "cookieMessage" }}',
accept: '{{ i18n "cookieAccept" }}',
decline: '{{ i18n "cookieDecline" }}',
}
},
},
services: [
{
name: 'google-analytics',
options: {
id: {{ .Site.Config.Services.GoogleAnalytics.ID }},
},
purposes: ['analytics'],
inject: true,
}
]
});
</script>
{{- /* vim: set ts=2 sw=2 et: */}}