29 lines
1.5 KiB
HTML
29 lines
1.5 KiB
HTML
{{/*
|
|
Comments include entry.
|
|
- If functional cookie consent is required, render a placeholder + template and load commentsConsent.ts.
|
|
- Otherwise, render provider partial directly.
|
|
*/}}
|
|
{{ if .Site.Params.comments.enabled }}
|
|
{{- $needsConsent := and .Site.Params.cookies.enabled .Site.Params.cookies.categories.functional -}}
|
|
{{- if $needsConsent -}}
|
|
{{/* Consent-gated comments - show placeholder until functional consent */}}
|
|
<div id="comments-consent-placeholder" class="consent-placeholder">
|
|
<p>{{ T "cookies.commentsDisabled" }}</p>
|
|
<button class="cookie-btn cookie-btn--primary" data-cookie-action="reopen">
|
|
{{ T "cookies.managePreferences" }}
|
|
</button>
|
|
</div>
|
|
<div id="comments-container" style="display: none;"></div>
|
|
<template id="comments-template">
|
|
{{ partial (printf "comments/provider/%s" .Site.Params.comments.provider) . }}
|
|
</template>
|
|
{{- $opts := dict "minify" hugo.IsProduction -}}
|
|
{{/* commentsConsent.ts is intentionally built and loaded here as an independent entry */}}
|
|
{{- $commentsScript := resources.Get "ts/commentsConsent.ts" | js.Build $opts | fingerprint -}}
|
|
<script type="text/javascript" src="{{ $commentsScript.RelPermalink }}" integrity="{{ $commentsScript.Data.Integrity }}" defer></script>
|
|
{{- else -}}
|
|
{{/* No consent required - load comments normally */}}
|
|
{{ partial (printf "comments/provider/%s" .Site.Params.comments.provider) . }}
|
|
{{- end -}}
|
|
{{ end }}
|