|
1 | 1 | {{/*
|
2 |
| - Uses the "products" frontmatter (list) |
| 2 | + Displays a list of products related to the current page. Use the "names" parameter to specify and show a subset of products. |
3 | 3 |
|
4 |
| - *FORMAT* |
5 |
| - products: |
6 |
| - - name: "Product Name 1" |
7 |
| - url: "/product-path1" |
8 |
| - icon: "product-icon-name1" |
9 |
| - - name: "Product Name 2" |
10 |
| - url: "/product-path2" |
11 |
| - icon: "product-icon-name2" |
| 4 | + @param products: array.<{name:string, url:string, icon:string}> - (frontmatter data) list of products. |
| 5 | + - name: name of product. should be unique to the array. |
| 6 | + - url: path to product documentation |
| 7 | + - icon: icon name from our iconfont (websites-modules) |
| 8 | + @param names: str - (named parameter) a comma-separated list of product names. Each name must match a product in the products list. Do not include spaces between names. |
12 | 9 |
|
13 | 10 | *EXAMPLE*
|
14 |
| - products: |
15 |
| - - name: Cloud SIEM |
16 |
| - url: /security/cloud_siem/ |
17 |
| - icon: siem |
18 |
| - - name: Workload Protection |
19 |
| - url: /security/threats/ |
20 |
| - icon: cloud-security-management |
| 11 | + products: |
| 12 | + - name: Cloud SIEM |
| 13 | + url: /security/cloud_siem/ |
| 14 | + icon: siem |
| 15 | + - name: Workload Protection |
| 16 | + url: /security/threats/ |
| 17 | + icon: cloud-security-management |
| 18 | + - name: DDSQL Editor |
| 19 | + url: /ddsql_editor/ |
| 20 | + icon: ddsql |
| 21 | + |
| 22 | + {{< product-availability >}} <-- shows all products |
| 23 | + OR |
| 24 | + {{< product-availability names="Cloud SIEM,DDSQL Editor" >}} <-- only shows 2 of the 3 products |
| 25 | + |
21 | 26 | */}}
|
22 | 27 |
|
| 28 | +{{ $products := .Page.Params.products }} |
| 29 | +{{ $names := .Get "names" }} |
| 30 | + |
| 31 | +{{ if $names }} |
| 32 | + {{/* if subset of products is requested */}} |
| 33 | + {{ $products = where $products "name" "in" (split $names ",") }} |
| 34 | +{{ end }} |
| 35 | + |
| 36 | +{{ $len := len $products }} |
| 37 | + |
23 | 38 | <div class="product-availability container mb-3 p-0">
|
24 | 39 | <div class="d-flex">
|
25 | 40 | <strong class="p-0">{{ i18n "available_for"}}:</strong>
|
26 |
| - <p class="mb-0 p-0"> |
27 |
| - {{ $len := len .Page.Params.products}} |
28 |
| - {{ range $idx, $product := .Page.Params.products }} |
| 41 | + <p class="mb-0 p-0 d-flex flex-wrap"> |
| 42 | + {{ range $idx, $product := $products }} |
29 | 43 | <span class="product-wrapper">
|
30 | 44 | <span class="product position-relative">
|
31 | 45 | {{ partial "icon" (dict "name" $product.icon "size" "14px")}}
|
32 | 46 | <span>{{$product.name}}</span>
|
33 |
| - <a class="border border-0 stretched-link" href="{{$product.url}}"></a> |
| 47 | + <a class="border-0 stretched-link" href="{{$product.url}}"></a> |
34 | 48 | </span>
|
35 |
| - <span>{{ if ne $idx (sub $len 1) }}|{{ end }}</span> |
| 49 | + <span class="separator">{{ if ne $idx (sub $len 1) }}|{{ end }}</span> |
36 | 50 | </span>
|
37 | 51 | {{ end }}
|
38 | 52 | </p>
|
|
0 commit comments