{{ end }} - +
+ {{ partial "banner" .}}

{{ .Title }}

{{ $content | safeHTML }} {{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f3a1797..d13af58 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -31,14 +31,7 @@

{{ .Title }}

{{ .Content }} - {{- with .Params.banner -}} - {{- if .enabled -}} - {{- $bannerPage := site.GetPage .md -}} - - {{- end -}} - {{- end -}} + {{ partial "banner" .}} {{ if (lt .WordCount 1) }} {{ range .Pages.ByWeight }} diff --git a/layouts/partials/banner.html b/layouts/partials/banner.html new file mode 100644 index 0000000..48fb39a --- /dev/null +++ b/layouts/partials/banner.html @@ -0,0 +1,22 @@ +{{- with .Params.banner -}} + {{- if .enabled -}} + + {{- $currentDate := now | dateFormat "2006-01-02" -}} + {{- $startDate := index . "start-date" | default "0001-01-01" -}} + {{- $endDate := index . "end-date" | default "9999-12-31" -}} + + + {{- if and (ge $currentDate $startDate) (le $currentDate $endDate) -}} + {{- if isset . "md" -}} + + {{- $bannerPage := site.GetPage .md -}} + + {{- else -}} + + + {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} \ No newline at end of file diff --git a/layouts/partials/list-main.html b/layouts/partials/list-main.html index cf9cd07..7facf94 100644 --- a/layouts/partials/list-main.html +++ b/layouts/partials/list-main.html @@ -18,14 +18,7 @@

- {{- with .Params.banner -}} - {{- if .enabled -}} - {{- $bannerPage := site.GetPage .md -}} - - {{- end -}} - {{- end -}} + {{ partial "banner" .}} {{ if or (lt .WordCount 1) (eq $PageTitle "F5 NGINX One Console") (eq $PageTitle "F5 NGINX App Protect DoS") (eq $PageTitle "F5 NGINX Plus") }}
From 52e069b5c9f8f9cbdc78bb006a6c16ac502d4896 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Tue, 27 May 2025 06:10:46 -0700 Subject: [PATCH 5/8] List: Added error to build if md is not provided --- layouts/partials/banner.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/banner.html b/layouts/partials/banner.html index 48fb39a..3920ca2 100644 --- a/layouts/partials/banner.html +++ b/layouts/partials/banner.html @@ -14,8 +14,8 @@ {{ $bannerPage.Content }} {{- else -}} - - + + {{ errorf "Required front matter parameter 'md' is missing or empty for banner." }} {{- end -}} {{- end -}} {{- end -}} From 6dc69b31a90c685e1c69a12cfd7a4dba00b5c906 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Tue, 27 May 2025 08:02:16 -0700 Subject: [PATCH 6/8] List: Change to readFile --- layouts/partials/banner.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/banner.html b/layouts/partials/banner.html index 3920ca2..62f9f71 100644 --- a/layouts/partials/banner.html +++ b/layouts/partials/banner.html @@ -9,9 +9,9 @@ {{- if and (ge $currentDate $startDate) (le $currentDate $endDate) -}} {{- if isset . "md" -}} - {{- $bannerPage := site.GetPage .md -}} + {{- $bannerPage := readFile .md -}} {{- else -}} From 267fb49c1dea436b6395b4714b0c81be6f2cd06f Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Tue, 27 May 2025 11:12:30 -0700 Subject: [PATCH 7/8] List: Moved banner to inside page header --- layouts/partials/list-main.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/list-main.html b/layouts/partials/list-main.html index 7facf94..84777ad 100644 --- a/layouts/partials/list-main.html +++ b/layouts/partials/list-main.html @@ -15,11 +15,11 @@

{{ .Content | markdownify }}

{{ end }} + + {{ partial "banner" .}} - {{ partial "banner" .}} - {{ if or (lt .WordCount 1) (eq $PageTitle "F5 NGINX One Console") (eq $PageTitle "F5 NGINX App Protect DoS") (eq $PageTitle "F5 NGINX Plus") }}
From ab547ea3ec7fb72acdc8b2225fa8f3e5aac0641c Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Wed, 28 May 2025 08:00:46 -0700 Subject: [PATCH 8/8] List: Changed to use callout partial in banner partial --- layouts/_default/list.html | 2 +- layouts/shortcodes/banner.html | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index d13af58..6164c75 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -31,7 +31,7 @@

{{ .Title }}

{{ .Content }} - {{ partial "banner" .}} + {{ partial "banner" . }} {{ if (lt .WordCount 1) }} {{ range .Pages.ByWeight }} diff --git a/layouts/shortcodes/banner.html b/layouts/shortcodes/banner.html index 75a0f98..5240248 100644 --- a/layouts/shortcodes/banner.html +++ b/layouts/shortcodes/banner.html @@ -1,7 +1,9 @@ {{- $type := .Get 0 | default (.Get "type") | default "" -}} {{- $title := .Get 1 | default (.Get "title") | default "" -}} -
- {{ $title }} -
- {{- .Inner | markdownify -}} -
\ No newline at end of file +{{ partial "callout.html" (dict + "class" $type + "title" $title + "icon" "fa-solid fa-triangle-exclamation" + "inline" true + "content" .Inner +) }} \ No newline at end of file