|
6 | 6 | {{ partial "coveo-atomic-search.html" (dict "id" "search-standalone-sidebar") }} |
7 | 7 | </div> |
8 | 8 |
|
9 | | - <!-- <div class="header__product-selector"> |
10 | | - {{ $nginxProducts := slice |
11 | | - (dict "title" "NGINX One Console" "url" "/nginx-one" "type" "nginx-one") |
12 | | - (dict "title" "NGINX Plus" "url" "/nginx" "type" "nginx-one") |
13 | | - (dict "title" "NGINX Instance Manager" "url" "/nginx-instance-manager" "type" "nginx-one") |
14 | | - (dict "title" "NGINX Ingress Controller" "url" "/nginx-ingress-controller" "type" "nginx-one") |
15 | | - (dict "title" "NGINX Gateway Fabric" "url" "/nginx-gateway-fabric" "type" "nginx-one") |
16 | | - (dict "title" "NGINX Open Source" "url" "https://nginx.org/en/docs/" "type" "nginx-one") |
17 | | - (dict "title" "NGINX Agent" "url" "/nginx-agent" "type" "nginx-one") |
18 | | - (dict "title" "NGINX App Protect WAF" "url" "/nginx-app-protect-waf" "type" "nginx-app-protect") |
19 | | - (dict "title" "NGINX App Protect DoS" "url" "/nginx-app-protect-dos" "type" "nginx-app-protect") |
20 | | - (dict "title" "NGINX as a Service for Azure" "url" "/nginxaas/azure/" "type" "nginx-as-a-service") |
21 | | - (dict "title" "NGINX Unit" "url" "https://unit.nginx.org/" "type" "nginx-other") |
22 | | - }} |
23 | | - {{ $productMap := dict }} |
24 | | - {{ range $nginxProducts }} |
25 | | - {{ if not (or (eq .title "NGINX Open Source" ) (eq .title "NGINX Unit")) }} |
26 | | - {{ $productId := index (split .url "/") 1 }} |
27 | | - {{ $productMap = merge $productMap (dict $productId .title) }} |
28 | | - {{ end }} |
| 9 | + {{ $relPermalink := .RelPermalink }} |
| 10 | + {{ $productIdentifier := index ((split $relPermalink "/")) 1 }} |
| 11 | + {{ $relPermalink := strings.TrimSuffix "/" $productIdentifier }} |
| 12 | + {{ $currentProductTitle := "" }} |
| 13 | + |
| 14 | + {{ with index .Site.Data "product-selector" }} |
| 15 | + {{ range $group := . }} |
| 16 | + {{ range $product := $group.products }} |
| 17 | + {{ $splitProductUrl := index ((split $product.url "/")) 1 }} |
| 18 | + {{ $suffixProductUrl := strings.TrimSuffix "/" $splitProductUrl | }} |
| 19 | + {{ $prefixProductUrl := strings.TrimPrefix "/" $suffixProductUrl | }} |
| 20 | + {{ if (eq $prefixProductUrl $productIdentifier) }} |
| 21 | + {{ $currentProductTitle = $product.title }} |
| 22 | + {{ end }} |
29 | 23 | {{ end }} |
30 | | - {{ $relPermalink := .RelPermalink }} |
31 | | - {{ $productIdentifier := index ((split $relPermalink "/")) 1 }} |
32 | | - {{ $productName := index $productMap $productIdentifier | default "Product Documentation" }} |
| 24 | + {{ end }} |
| 25 | + {{ end }} |
33 | 26 |
|
34 | | - <button class="product-selector__button" id="product-selector-button"> |
35 | | - {{/* product name and selector */}} |
36 | | - <span class="product-name">{{ $productName }}</span> |
37 | | - <span class="product-selector-button-icon"> |
38 | | - <svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"> |
39 | | - <path d="M1 13L7 7L0.999999 1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> |
40 | | - </svg> |
41 | | - </span> |
42 | | - </button> |
43 | | - <div class="product-selector" id="product-selector" style="display: none"> |
44 | | - {{ $groupedProducts := dict |
45 | | - "nginx-one" (where $nginxProducts "type" "nginx-one") |
46 | | - "nginx-app-protect" (where $nginxProducts "type" "nginx-app-protect") |
47 | | - "nginx-as-a-service" (where $nginxProducts "type" "nginx-as-a-service") |
48 | | - "nginx-other" (where $nginxProducts "type" "nginx-other") |
49 | | - }} |
50 | | - {{ $orderedKeys := slice "nginx-one" "nginx-app-protect" "nginx-as-a-service" "nginx-other" }} |
51 | | - {{ range $orderedKeys }} |
52 | | - {{ $type := . }} |
53 | | - {{ $products := index $groupedProducts $type }} |
54 | | - <div class="product-selector-content" id="product-selector-content"> |
55 | | - <p>{{ $type | humanize | title | upper }}</p> |
56 | | - <ul> |
57 | | - {{ range $products }} |
58 | | - <li> |
59 | | - <a href="{{ .url }}">{{ .title }}</a> |
60 | | - </li> |
61 | | - {{ end }} |
62 | | - </ul> |
63 | | - </div> |
64 | | - {{ end }} |
65 | | - </div> |
66 | | - </div> --> |
67 | 27 |
|
68 | 28 | <div class="product-selector"> |
69 | 29 | <details class="product-selector__section"> |
70 | 30 | <summary class="product-selector__toggle"> |
71 | | - <span class="product-selector__toggle-text">NGINX One</span> |
| 31 | + |
| 32 | + <span class="product-selector__toggle-text"> |
| 33 | + {{ if $currentProductTitle }} |
| 34 | + {{ $currentProductTitle }} |
| 35 | + {{ else }} |
| 36 | + Product Documentation |
| 37 | + {{ end }} |
| 38 | + </span> |
72 | 39 | <span class="product-selector__chevron"> |
73 | 40 | {{ partial "lucide" (dict "context" . "icon" "chevron-right") }} |
74 | 41 | </span> |
75 | 42 | </summary> |
76 | 43 | <div class="product-selector__content"> |
77 | 44 | {{ with index .Site.Data "product-selector" }} |
78 | | - {{ $groups := sort . "order" }} |
| 45 | + {{ $groups := . }} |
79 | 46 | {{ range $group := $groups }} |
80 | 47 | <h3 class="product-selector__product-group">{{ upper (replace $group.productGroup "-" " ") }}</h3> |
81 | 48 | <ul> |
|
0 commit comments