static/frontend/vuln: limit alias count in vuln list
Some vulns have 8+ aliases causing the vuln entries to
overflow. Limiting the entries in the list to 2 aliases
will improve fix the layout of the list.
Change-Id: I3a3baa39b7c794636ab8764bdaf0558f543ebf8d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/427537
Reviewed-by: Julie Qiu <julieqiu@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
diff --git a/static/frontend/vuln/vuln.tmpl b/static/frontend/vuln/vuln.tmpl
index c1b76ed..c94b25b 100644
--- a/static/frontend/vuln/vuln.tmpl
+++ b/static/frontend/vuln/vuln.tmpl
@@ -25,9 +25,12 @@
{{/* . is OSVEntry */}}
<div class="Vuln-details">
<ul class="Vuln-detailsMetadata">
- {{if .Aliases}}
+ {{with $aliases := .Aliases}}
<li class="go-textSubtle Vuln-alias">
- {{range $i, $v := .Aliases}}{{if ne $i 0}}, {{end}}{{$v}}{{end}}
+ {{range $i, $v := $aliases}}
+ {{- if lt $i 2}}{{- if ne $i 0}}, {{end -}}{{$v}}{{end -}}
+ {{- if eq $i 2}}, and {{subtract (len $aliases) 2}} more{{end -}}
+ {{end}}
</li>
{{end}}
<li class="go-textSubtle">Affects: