Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ maxAge = -1
github_subdir = "exampleSite"
enable_last_modified = true
disable_coveo = true
disable_qualtrics = true
coveo_search_redirect = "/search.html"
3 changes: 2 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ <h1>{{ .Title }}</h1>
{{ end }}

{{ partial "version-list" . }}
{{ if .Site.Params.enable_qualtrics }}
{{ $qualtricsEnabled := partial "get-feature-flags.html" (dict "featureName" "disable_qualtrics" "Site" .Site) }}
{{ if $qualtricsEnabled }}
{{ partial "qualtrics-feedback.html" }}
{{ end }}
</article>
Expand Down
11 changes: 11 additions & 0 deletions layouts/partials/get-feature-flags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- $featureName := .featureName | default "" -}}
{{- $param := (string (index .Site.Params $featureName)) | default "false" -}} <!-- Added default in case param does not exist, we should default to a value instead of nil -->
{{- $result := false -}}

{{- if ne $featureName "" -}}
{{- if not (eq $param "true") -}}
{{- $result = true -}}
{{- end -}}
{{- end -}}

{{- return $result -}}
3 changes: 2 additions & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
</div>
{{ if ( not ( in .Site.Params.buildtype "package" ) ) }}
<!-- Mobile button -->
{{ if not (or (eq .Site.Params.disable_coveo true) (eq .Site.Params.disable_coveo "true")) }}
{{ $coveoEnabled := partial "get-feature-flags.html" (dict "featureName" "disable_coveo" "Site" .Site) }}
{{ if $coveoEnabled }}
<label class="header__search--mobile--search--button"for="search-standalone-header-panel" data-testid="header__search--mobile--search--button">
{{ partial "lucide" (dict "context" . "icon" "search") }}
</label>
Expand Down
12 changes: 7 additions & 5 deletions layouts/partials/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
<meta http-equiv="last-modified" content="{{ .Page.Lastmod.Format "02/01/2006" }}" />
{{ end }}


{{ $coveoEnabled := partial "get-feature-flags.html" (dict "featureName" "disable_coveo" "Site" .Site) }}
{{ $qualtricsEnabled := partial "get-feature-flags.html" (dict "featureName" "disable_qualtrics" "Site" .Site) }}
{{/* set custom CSP to load styles and scripts with special handling for GTM scripts (requires unsafe-inline) and Dev Portal page(s) (requires 'unsafe-eval') */}}
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'
https://consent.trustarc.com/ https://mktg.tags.f5.com/basic/prod/utag.sync.js
{{ if not (or (eq .Site.Params.disable_coveo true) (eq .Site.Params.disable_coveo "true")) }} https://static.cloud.coveo.com/ {{ end }}
https://consent.trustarc.com/
https://mktg.tags.f5.com/basic/prod/utag.sync.js
{{ if $coveoEnabled }}https://static.cloud.coveo.com/{{ end }}
https://*.f5.com/
https://*.netlify.app https://gist.github.com
https://tag.demandbase.com/pscSDsz4.min.js
Expand All @@ -54,8 +56,8 @@
https://cdn.bizible.com/xdc.js
https://f5networksglobalprod.122.2o7.net/
https://f5networksnginxdocs.122.2o7.net/
https://*.siteintercept.qualtrics.com/SIE/?Q_ZID=*
https://siteintercept.qualtrics.com/
{{ if $qualtricsEnabled }}https://*.siteintercept.qualtrics.com/SIE/?Q_ZID=*{{ end }}
{{ if $qualtricsEnabled }}https://siteintercept.qualtrics.com/{{ end }}
{{ if in .Params.doctypes "devportal" }} 'unsafe-eval' {{end}};
worker-src 'self' blob:">
{{/* end */}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
{{ end }}

<!-- Coveo Atomic -->
{{ if not (or (eq .Site.Params.disable_coveo true) (eq .Site.Params.disable_coveo "true")) }}
{{ $coveoEnabled := partial "get-feature-flags.html" (dict "featureName" "disable_coveo" "Site" .Site) }}
{{ if $coveoEnabled }}
<script
type="module"
src="https://static.cloud.coveo.com/atomic/v3.19.0/atomic.esm.js"
Expand All @@ -40,7 +41,6 @@
{{ $.Scratch.Set "coveoSc" $coveo}}
{{ $secureCoveo := $.Scratch.Get "coveoSc" | minify | fingerprint "sha512" }}


<script src="{{ $secureCoveo.RelPermalink }}" integrity="{{ $secureCoveo.Data.Integrity }}"type="text/javascript"></script>
{{ end }}

Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/styles.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<link href="{{ $cssHighlight.RelPermalink }}" rel="stylesheet" type="text/css">

<!-- load CSS Atomic CSS -->
{{ if not (or (eq .Site.Params.disable_coveo true) (eq .Site.Params.disable_coveo "true")) }}
{{ $coveoEnabled := partial "get-feature-flags.html" (dict "featureName" "disable_coveo" "Site" .Site) }}
{{ if $coveoEnabled }}
<link
rel="stylesheet"
href="https://static.cloud.coveo.com/atomic/v3.19.0/themes/coveo.css"
Expand Down
3 changes: 2 additions & 1 deletion layouts/search/single.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ define "main" }}
{{ if not (or (eq .Site.Params.disable_coveo true) (eq .Site.Params.disable_coveo "true")) }}
{{ $coveoEnabled := partial "get-feature-flags.html" (dict "featureName" "disable_coveo" "Site" .Site) }}
{{ if $coveoEnabled }}
<section class="search no-sidebar">
{{ partial "coveo-atomic.html" .}}
</section>
Expand Down
Loading