Skip to content

Added banner to list if front matter is present #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
<h1>{{ .Title }}</h1>
{{ .Content }}

{{- with .Params.banner -}}
{{- if .enabled -}}
<div class="banner banner-{{ .type }}">
{{ partial .md . }}
</div>
{{- end -}}
{{- end -}}

{{ if (lt .WordCount 1) }}
{{ range .Pages.ByWeight }}
<h2>
Expand Down
117 changes: 90 additions & 27 deletions layouts/partials/list-main.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,106 @@
<div class="list-page">
<div class="col-md-12 col-xl-12 py-md-3 pl-md-5">
{{ $PageTitle := .Title }}
<div class="col-md-12 col-xl-12 py-md-3" style="margin-left: -1.75em;">
<div class="page-header list">
<h1 class="bd-title">
{{ .Title }}
</h1>
{{ if .Description }}
<p>
{{ .Description | markdownify }}
</p>
{{ end}}
{{ if .Content }}
<p class="bd-lead">
<p>
{{ .Content | markdownify }}
</p>
{{ end }}
</div>
</div>
{{ if lt .WordCount 1 }}
<section class="col-md-12 col-xl-12 py-md-3 pl-md-5" id="section-content-list">


{{- with .Params.banner -}}
{{- if .enabled -}}
<div class="banner banner-{{ .type }}">
{{ partial .md . }}
</div>
{{- end -}}
{{- end -}}

{{ if or (lt .WordCount 1) (eq $PageTitle "F5 NGINX One Console") (eq $PageTitle "F5 NGINX App Protect DoS") (eq $PageTitle "F5 NGINX Plus") }}
<section>
<div class="row">
<div class="card-deck">
{{ range .Pages.ByWeight }}
<div class="col-md-5 card">
<div class="card-body">
<h3 class="card-title">
<i class="fas fa-{{if eq .Kind "page"}}file-alt{{else}}book{{end}} fa-2x card-img-top"></i>
<a href="{{ if .Params.url}}{{ .Params.url}}{{else}}{{ .Permalink }}{{end}}">{{ .Title }}</a>
</h3>
<div class="card-deck">
{{ range .Pages.GroupBy "Section" }}
{{ range .Pages.ByWeight }}
<div class="col-md-5 card">
<div class="card-body">
<h3 class="card-title" style="display: flex; align-items: center; gap: 5px;">
<i class="fas fa-{{if eq .Kind "page"}}file-alt{{else}}book{{end}} fa-lg card-img-top"></i>
<a href="{{ if .Params.url}}{{ .Params.url}}{{else}}{{ .Permalink }}{{end}}">{{ .Title }}</a>
</h3>
{{ if and (eq $PageTitle "F5 NGINX One Console") (eq .Title "How-to guides") }}
<ul style="padding-top: 10px;">
{{ range .Pages }}
{{ if eq .Kind "section" }}
{{ range .Pages }}
<li><a href="{{ .Permalink }}"> {{ .Title }}</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
{{ end }}
{{ if and (eq $PageTitle "F5 NGINX One Console") (eq .Title "API")}}
<ul style="padding-top: 10px;">
{{ range .Pages }}
<li><a href="{{ .Permalink }}"> {{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if and (eq $PageTitle "F5 NGINX One Console") (eq .Title "Changelog") }}
{{ partial "changelog-date.html" . }}
{{ end }}
</div>
</div>
</div>
{{ end }}
{{ end }}
</div>
{{ if eq $PageTitle "F5 NGINX One Console" }}
<h1 class="bd-title" style="margin-top: 15px;">Other Products</h1>
{{ $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 }}
<div class="card-deck">
<p style="margin-left: 15px; width: 100%; font-weight: bold;">{{ $type | humanize | title }}</p>
{{ range $products }}
<div class="card" style="margin-top: 0px; {{ if eq (len $products) 1 }}max-width: calc(50% - 30px);{{ else }}min-width: 40%;{{ end }}">
<div class="card-body">
<h3 class="card-title" style="display: flex; align-items: center;">
<img class="card-img-top" src="{{ .Site.BaseURL }}/images/icons/{{ .imgSrc }}.png"/>
<a href="{{ if eq .title "NGINX Open Source" }}{{ .url }}{{ else }}{{ .Site.BaseURL }}{{ .url }}{{ end }}">{{ .title }}</a>
</h3>
<p >
{{ if .description }}{{ .description | markdownify }}{{ end }}
</p>
</div>
</div>
{{ end }}
</div>
{{ end }}
</div>
</div>
{{ end }}
</div>
</section>
{{ end }}
</div>


{{ if not .IsHome }}
<div class="row justify-content-center">
{{ partial "pagination.html" . }}
</div>
{{ end }}


{{end}}
</div>
Loading