diff --git a/assets/css/f5-hugo.css b/assets/css/f5-hugo.css index 3f82f1e..03b6b5c 100644 --- a/assets/css/f5-hugo.css +++ b/assets/css/f5-hugo.css @@ -423,6 +423,16 @@ h3.card-title { font-weight: 400; } +/* Landing page cards */ +.text-content .card-layout { + .card-section { + margin-bottom: 1rem; + + strong { + font-weight: 500; + } + } +} #f5-related, #nginx-products { width: 100%; diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index 64bfe7e..f920dc6 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -674,7 +674,6 @@ nav { h2 { font-size: 1.5rem; - margin: 1rem 0 0rem 0; } hr { @@ -1188,6 +1187,35 @@ h6:has(a):hover { color: oklch(var(--color-brand)); } +/* Landing page cards */ + +.text-content .card-layout { + grid-column: 1 / -1; + + .card-section { + margin-bottom: 1rem; + + strong { + font-weight: 500; + } + } +} + +/* Optional grid layout */ +.card-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(120px, 500px)); + gap: 1.5rem; + margin-top: 1rem; + + .card-container { + border: 1px solid oklch(var(--color-codeblock-border)); + box-shadow: 3px 3px 0px oklch(var(--color-shadow)); + padding: 1rem 2rem 2rem 2rem; + margin-bottom: 1.5rem; + } +} + /* MARK: Tables */ table { diff --git a/exampleSite/content/test-product/_index.md b/exampleSite/content/test-product/_index.md index 5b74134..96b971a 100644 --- a/exampleSite/content/test-product/_index.md +++ b/exampleSite/content/test-product/_index.md @@ -2,4 +2,26 @@ description: Test pages for nginx-hugo-theme title: Test pages weight: 100 +hasCustomContent: true --- + +{{< card-layout >}} + + + {{< card-section >}} + {{< card title="Call Out usages" >}} + + Examples for call-out shortcode + {{}} + {{< card title="Code Block usages" >}} + Examples for codeblock shortcode + {{}} + {{}} + + # Other Products on ExampleSite + {{< card-section title="NGINX" showAsCards="true" >}} + {{< card title="NGINX Plus" titleUrl="/nginx/" >}} + Installing NGINX + {{}} + {{}} +{{}} \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 6164c75..ca57cec 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -29,17 +29,22 @@ {{ end }}

{{ .Title }}

- {{ .Content }} {{ partial "banner" . }} - {{ if (lt .WordCount 1) }} - {{ range .Pages.ByWeight }} -

- {{ .Title }} -

+ {{ $hasCustomContent := .Params.hasCustomContent | default false }} + {{ if $hasCustomContent }} + {{ .Page.Scratch.Set "custom-landing-page-file-name" "custom-landing-page.html" }} + {{ .Page.Scratch.Set "custom-landing-page-context" . }} + {{ .Content }} + {{ else }} + {{ .Content }} + {{ range .Pages.ByWeight }} +

+ {{ .Title }} +

+ {{ end }} {{ end }} - {{end}}
{{ if .Page.Lastmod }} diff --git a/layouts/partials/custom-landing-page.html b/layouts/partials/custom-landing-page.html new file mode 100644 index 0000000..fb9d553 --- /dev/null +++ b/layouts/partials/custom-landing-page.html @@ -0,0 +1,48 @@ +{{ $cards := .Page.Scratch.Get "cards" }} +{{ $showAsCards := index ( .Page.Scratch.Get "showAsCards") "main" }} +{{ $class := "card-grid wide"}} + +
+ +
+
+
+ {{ range .Pages.GroupBy "Section" }} + {{ range .Pages.ByWeight }} + {{ $title := .Title }} +
+
+

+ + {{ .Title }} +

+ {{ range $cards }} + {{ if eq .title $title }} +

{{ .content }}

+ {{ end }} + {{ end }} +
+
+ {{ end }} + {{ end }} +
+
+
+ + +
+ {{ range .Pages.ByWeight }} + {{ $title := .Title }} +
+

+ {{ $title }} +

+ {{ range $cards }} + {{ if eq .title $title }} +

{{- .content -}}

+ {{ end }} + {{ end }} +
+ {{ end }} +
+
\ No newline at end of file diff --git a/layouts/partials/list-main.html b/layouts/partials/list-main.html index 84777ad..26cc2ba 100644 --- a/layouts/partials/list-main.html +++ b/layouts/partials/list-main.html @@ -10,91 +10,33 @@

{{ .Description | markdownify }}

{{ end}} - {{ if .Content }} -

- {{ .Content | markdownify }} -

- {{ 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") }} -
-
-
- {{ range .Pages.GroupBy "Section" }} - {{ range .Pages.ByWeight }} -
-
+ {{ $hasCustomContent := .Params.hasCustomContent | default false }} + {{ if $hasCustomContent }} + {{ .Page.Scratch.Set "custom-landing-page-file-name" "custom-landing-page.html" }} + {{ .Page.Scratch.Set "custom-landing-page-context" . }} + {{ .Content }} + {{ else }} +
+
+
+ {{ range .Pages.GroupBy "Section" }} + {{ range .Pages.ByWeight }} + {{ $title := .Title }} +
+

- - {{ .Title }} + + {{ .Title }}

- {{ if and (eq $PageTitle "F5 NGINX One Console") (eq .Title "How-to guides") }} -
    - {{ range .Pages }} - {{ if eq .Kind "section" }} - {{ range .Pages }} -
  • {{ .Title }}
  • - {{ end }} - {{ end }} - {{ end }} -
- {{ end }} - {{ if and (eq $PageTitle "F5 NGINX One Console") (eq .Title "API")}} - - {{ end }} - {{ if and (eq $PageTitle "F5 NGINX One Console") (eq .Title "Changelog") }} - {{ partial "changelog-date.html" . }} - {{ end }} +
-
+ {{ end }} {{ end }} - {{ end }} -
- {{ if eq $PageTitle "F5 NGINX One Console" }} -

Other Products

- {{ $nginxProducts := slice - (dict "title" "NGINX Instance Manager" "url" "/nginx-instance-manager" "imgSrc" "NGINX-Instance-Manager-product-icon" "type" "local-console-option" "description" "Track and control NGINX Open Source and NGINX Plus instances.") - (dict "title" "NGINX Ingress Controller" "url" "/nginx-ingress-controller" "imgSrc" "NGINX-Ingress-Controller-product-icon" "type" "kubernetes-solutions" "description" "Kubernetes traffic management with API gateway, identity, and observability features.") - (dict "title" "NGINX Gateway Fabric" "url" "/nginx-gateway-fabric" "imgSrc" "NGINX-product-icon" "type" "kubernetes-solutions" "description" "Next generation Kubernetes connectivity using the Gateway API.") - (dict "title" "NGINX App Protect WAF" "url" "/nginx-app-protect-waf" "imgSrc" "NGINX-App-Protect-WAF-product-icon" "type" "security" "description" "Lightweight, high-performance, advanced protection against Layer 7 attacks on your apps and APIs.") - (dict "title" "NGINX App Protect DoS" "url" "/nginx-app-protect-dos" "imgSrc" "NGINX-App-Protect-DoS-product-icon" "type" "security" "description" "Defend, adapt, and mitigate against Layer 7 denial-of-service attacks on your apps and APIs.") - (dict "title" "NGINX Plus" "url" "/nginx" "imgSrc" "NGINX-Plus-product-icon-RGB" "type" "modern-app-delivery" "description" "The all-in-one load balancer, reverse proxy, web server, content cache, and API gateway.") - (dict "title" "NGINX Open Source" "url" "https://nginx.org/en/docs/" "imgSrc" "NGINX-product-icon" "type" "modern-app-delivery" "description" "The open source all-in-one load balancer, content cache, and web server") - }} - {{ $groupedProducts := dict - "local-console-option" (where $nginxProducts "type" "local-console-option") - "kubernetes-solutions" (where $nginxProducts "type" "kubernetes-solutions") - "security" (where $nginxProducts "type" "security") - "modern-app-delivery" (where $nginxProducts "type" "modern-app-delivery") - }} - {{ range $type, $products := $groupedProducts }} -
-

{{ $type | humanize | title }}

- {{ range $products }} -
-
-

- - {{ .title }} -

-

- {{ if .description }}{{ .description | markdownify }}{{ end }} -

-
-
- {{ end }} -
- {{ end }} - {{ end }} -
-
- {{end}} + + + + {{ end }} + + \ No newline at end of file diff --git a/layouts/shortcodes/card-layout.html b/layouts/shortcodes/card-layout.html new file mode 100644 index 0000000..564b334 --- /dev/null +++ b/layouts/shortcodes/card-layout.html @@ -0,0 +1,5 @@ + +{{ $customLandingPageFileName := .Page.Scratch.Get "custom-landing-page-file-name" }} +{{ $customLandingPageContext := .Page.Scratch.Get "custom-landing-page-context" }} +{{ partial $customLandingPageFileName $customLandingPageContext }} +
{{- .Inner | markdownify -}}
\ No newline at end of file diff --git a/layouts/shortcodes/card-section.html b/layouts/shortcodes/card-section.html new file mode 100644 index 0000000..11339a5 --- /dev/null +++ b/layouts/shortcodes/card-section.html @@ -0,0 +1,28 @@ +{{ $title := .Get "title" }} +{{ $showAsCardsParam := .Get "showAsCards" | default "false"}} +{{- /* Validate the parameter strictly */ -}} +{{- if not (in (slice "true" "false") $showAsCardsParam) -}} + {{- warnf "The '' Shortcode parameter 'showAsCards' must be 'true' or 'false', but got: '%s'. This will now default to 'false'" $showAsCardsParam -}} +{{- end -}} +{{- $showAsCards := cond (eq $showAsCardsParam "true") "true" "false" -}} +{{- $current := .Page.Scratch.Get "showAsCards" | default (dict) -}} +{{- $newShowAsCards := dict ($title | default "main") ($showAsCards) -}} +{{- .Page.Scratch.Set "showAsCards" (merge $current ($newShowAsCards)) -}} +{{- $class := "card-grid wide" -}} +{{- /* Validate that the parent is card-layout */ -}} +{{ if eq .Parent.Name "card-layout"}} + +
+ {{- if $title -}} + {{- $title -}} +
{{- .Inner -}}
+ {{ end }} +
+{{ else }} + {{ errorf "The '' must be nested directly inside the shortcode ''. Please see the exampleSite for an example of usage." }} +{{ end }} \ No newline at end of file diff --git a/layouts/shortcodes/card.html b/layouts/shortcodes/card.html new file mode 100644 index 0000000..f48bd6d --- /dev/null +++ b/layouts/shortcodes/card.html @@ -0,0 +1,38 @@ +{{- $title := .Get "title" -}} +{{- $titleUrl := .Get "titleUrl" | default "/" -}} +{{- $icon := .Get "icon" | default "NGINX-product-icon" -}} +{{- $current := .Page.Scratch.Get "cards" | default (slice) -}} +{{- $newCard := dict "title" ($title) "content" (.Inner) -}} +{{- .Page.Scratch.Set "cards" ($current | append $newCard) -}} +{{- /* Validate that the parent is card-section */ -}} +{{- if eq .Parent.Name "card-section" -}} + +
+
+

+ {{- if $icon -}} + + {{- end -}} + {{- if ($title) -}} + {{- $title -}} + {{- else -}} + {{ errorf "Old theme: Missing param 'title'" }} + {{- end -}} +

+

{{- .Inner -}}

+
+
+{{- else -}} + {{ errorf "The '' must be nested directly inside the shortcode ''. Please see the exampleSite for an example of usage." }} +{{- end -}} \ No newline at end of file diff --git a/layouts/shortcodes/changelog-dates.html b/layouts/shortcodes/changelog-dates.html new file mode 100644 index 0000000..0e1f6ff --- /dev/null +++ b/layouts/shortcodes/changelog-dates.html @@ -0,0 +1 @@ +{{ partial "changelog-date.html" . }} \ No newline at end of file