Suppress OneTrust cookie banner on local hugo server (#2331)

* Suppress OneTrust cookie banner on hugo server

Gate the OneTrust loader on hugo.IsProduction so the consent banner
no longer renders during local development. Netlify production and
deploy-preview builds set HUGO_ENV=production (or default to it),
so the banner still loads in every deployed context.

Mirrors the gating pattern already used by the Segment loader
immediately below.

* Gate OneTrust on hugo.IsServer instead of hugo.IsProduction

The previous gate used hugo.IsProduction, which is also false on Netlify
deploy previews (HUGO_ENV=staging) and would suppress the banner there.
Switch to (not hugo.IsServer) so the banner is suppressed only during
local hugo server runs and renders on every hugo build target —
production, deploy-preview, and branch builds alike.
This commit is contained in:
Dylan Couzon
2026-05-07 17:41:05 +02:00
committed by GitHub
parent 6032aff1f5
commit 59420ea8e8
@@ -6,7 +6,7 @@
</script> </script>
<!-- OneTrust Cookies Consent Notice start for local.qdrant.tech --> <!-- OneTrust Cookies Consent Notice start for local.qdrant.tech -->
{{ if .Site.Params.onetrustScriptID }} {{ if and (not hugo.IsServer) .Site.Params.onetrustScriptID }}
<script <script
src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"
type="text/javascript" type="text/javascript"