Skip to content

Commit ccd3584

Browse files
committed
Make webinar banner config-toggleable via params.yaml
1 parent e23ec69 commit ccd3584

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

config/_default/params.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ anniversaryBanner:
88
- /paddle-checkout/
99
- /hub/billing/
1010

11+
webinarBanner:
12+
enabled: true
13+
excludePaths:
14+
- /downloads-thanks/
15+
- /paddle-checkout/
16+
- /hub/billing/
17+
1118
releases:
1219
exe:
1320
version: 1.19.2

layouts/_default/baseof.html

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,28 @@
7676
{{- end -}}
7777
{{- end -}}
7878
{{- .Scratch.Set "anniversaryBannerActive" $showAnniversaryBanner -}}
79+
{{- $webinarBanner := .Site.Params.webinarBanner -}}
80+
{{- $showWebinarBanner := false -}}
81+
{{- if and $webinarBanner $webinarBanner.enabled -}}
82+
{{- $showWebinarBanner = true -}}
83+
{{- $currentPath := .RelPermalink -}}
84+
{{- range $webinarBanner.excludePaths -}}
85+
{{- if hasPrefix $currentPath . -}}
86+
{{- $showWebinarBanner = false -}}
87+
{{- end -}}
88+
{{- end -}}
89+
{{- end -}}
90+
{{- .Scratch.Set "webinarBannerActive" $showWebinarBanner -}}
7991
{{ partial "nav.html" . }}
8092
{{- if $showAnniversaryBanner -}}
8193
{{ partial "anniversary-banner.html" . }}
8294
{{- end -}}
83-
{{- $topPadding := cond .IsHome "" "pt-24 md:pt-18" -}}
84-
{{- if $showAnniversaryBanner -}}
95+
{{- $topPadding := cond .IsHome "" "pt-12" -}}
96+
{{- if and $showWebinarBanner (not $showAnniversaryBanner) -}}
97+
{{- $topPadding = cond .IsHome "" "pt-24 md:pt-18" -}}
98+
{{- else if and (not $showWebinarBanner) $showAnniversaryBanner -}}
99+
{{- $topPadding = cond .IsHome "" "pt-28 md:pt-24" -}}
100+
{{- else if and $showWebinarBanner $showAnniversaryBanner -}}
85101
{{- $topPadding = cond .IsHome "" "pt-40 md:pt-32" -}}
86102
{{- end -}}
87103
<div class="bg-gray-100 min-h-[80vh] {{ $topPadding }}">

layouts/partials/nav.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
{{- $backgroundColor := cond .IsHome "bg-dark" "bg-white" -}}
55
{{- $currentRelPermalink := .RelPermalink -}}
66
<nav class="w-full max-h-screen {{ $textColor }} fixed {{ $backgroundColor }} shadow-sm z-50">
7+
{{- if .Scratch.Get "webinarBannerActive" -}}
78
<div class="w-full bg-primary text-center text-sm text-white p-0.5">
89
<p>{{ i18n "webinar_banner" | safeHTML }}</p>
910
</div>
11+
{{- end -}}
1012
<div class="flex justify-between items-stretch w-full lg:px-8">
1113
<!-- Regular Navigation -->
1214
<div class="flex items-stretch">

0 commit comments

Comments
 (0)