From 4a8bfb9b56b83f9252c5994fb599ecc946f30fcb Mon Sep 17 00:00:00 2001 From: Michael McKeen Date: Fri, 12 Sep 2025 14:18:10 -0400 Subject: [PATCH 1/2] ProductSelector: Match product identifier exactly Resolve issues when a product ID is a subset of another --- layouts/partials/sidebar-v2.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/sidebar-v2.html b/layouts/partials/sidebar-v2.html index c886bbfb..5b0c35f0 100644 --- a/layouts/partials/sidebar-v2.html +++ b/layouts/partials/sidebar-v2.html @@ -20,7 +20,7 @@ {{ range $product := $group.products }} {{ if not $product.extUrl }} {{ $escaped := replace $product.url "/" "\\/" }} - {{ $pattern := printf "/%s(|$)" $escaped }} + {{ $pattern := printf "/(%s)/" $escaped }} {{ if strings.FindRE $pattern $normalizedPath }} {{ $currentProductTitle = $product.title }} {{ end }} From a11a0a1c4f3e3d66511bc070b3fe0a8967040981 Mon Sep 17 00:00:00 2001 From: Michael McKeen Date: Fri, 12 Sep 2025 14:42:21 -0400 Subject: [PATCH 2/2] ProductSelector: Trim trailing/leading slashes in url identifier --- layouts/partials/sidebar-v2.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/layouts/partials/sidebar-v2.html b/layouts/partials/sidebar-v2.html index 5b0c35f0..cc45b812 100644 --- a/layouts/partials/sidebar-v2.html +++ b/layouts/partials/sidebar-v2.html @@ -19,8 +19,13 @@ {{ range $group := . }} {{ range $product := $group.products }} {{ if not $product.extUrl }} - {{ $escaped := replace $product.url "/" "\\/" }} + + {{ $escaped := strings.TrimPrefix "/" $product.url }} + {{ $escaped = strings.TrimSuffix "/" $escaped }} + + {{ $escaped = replace $escaped "/" "\\/" }} {{ $pattern := printf "/(%s)/" $escaped }} + {{ if strings.FindRE $pattern $normalizedPath }} {{ $currentProductTitle = $product.title }} {{ end }}