Skip to content

Commit 77abd68

Browse files
authored
ProductSelector: Open external links in a new tab (#367)
1 parent 3479ca1 commit 77abd68

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

exampleSite/data/product-selector.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
- title: "Test Product"
44
url: "/test-product"
55

6+
- productGroup: Test External Links
7+
products:
8+
- title: "NGINX.org"
9+
url: https://nginx.org/index.html
10+
extUrl: true
11+
612
- productGroup: NGINX
713
products:
814
- title: "NGINX"

layouts/partials/sidebar-v2.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ <h3 class="product-selector__product-group">{{ $group.productGroup }}</h3>
5151
<ul>
5252
{{ $products := sort $group.products "productOrder" }}
5353
{{ range $product := $products }}
54-
<li class="product-selector__product"><a href="{{ $product.url }}">{{ $product.title }}</a></li>
54+
<li class="product-selector__product">
55+
<a
56+
href="{{ $product.url }}"
57+
aria-label="{{ $product.title }} documentation"
58+
{{ if $product.extUrl }} target="_blank" {{ end }}
59+
>
60+
{{ $product.title }}
61+
</a>
62+
</li>
5563
{{ end }}
5664
</ul>
5765
{{ end }}

0 commit comments

Comments
 (0)