static/frontend: added fix to validate link text before rendering

code will only render links when the link body is not empty.
https://screenshot.googleplex.com/5LG3vBJXdKFzaqa.png

Change-Id: I4b4bd9223b9623662876be60cbcfb01b65a79ade
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/513855
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Auto-Submit: Jamal Carvalho <jamal@golang.org>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
diff --git a/static/frontend/search/search.tmpl b/static/frontend/search/search.tmpl
index 2da6909..1251ba3 100644
--- a/static/frontend/search/search.tmpl
+++ b/static/frontend/search/search.tmpl
@@ -145,7 +145,7 @@
           <div class="SearchSnippet-sub go-textSubtle">
             <strong>{{.Heading}}</strong>
             {{range $i, $v := .Links}}
-              {{if lt $i 5}}
+              {{if and (lt $i 5) (ne $v.Body "")}}
                 <a class="go-Chip go-Chip--subtle"
                     href="/{{$v.Href}}"
                     {{if gt $i 4 }}data-hidden="true"{{end}}
diff --git a/tests/screentest/testdata/ci/vuln-nonstdlib-module-540x1080.a.png b/tests/screentest/testdata/ci/vuln-nonstdlib-module-540x1080.a.png
index 4582de0..6cb37ba 100644
--- a/tests/screentest/testdata/ci/vuln-nonstdlib-module-540x1080.a.png
+++ b/tests/screentest/testdata/ci/vuln-nonstdlib-module-540x1080.a.png
Binary files differ
diff --git a/tests/screentest/testdata/ci/vuln-nonstdlib-module.a.png b/tests/screentest/testdata/ci/vuln-nonstdlib-module.a.png
index 30b9281..a12de1e 100644
--- a/tests/screentest/testdata/ci/vuln-nonstdlib-module.a.png
+++ b/tests/screentest/testdata/ci/vuln-nonstdlib-module.a.png
Binary files differ