diff --git a/layouts/shortcodes/text.html b/layouts/shortcodes/text.html
index e8e6412750..40f2368244 100644
--- a/layouts/shortcodes/text.html
+++ b/layouts/shortcodes/text.html
@@ -52,6 +52,9 @@ be invalid HTML
{{ $branch := .Site.Data.args.branch_name }}
{{ $links := findRE "@(.*?)@" ($scratch.Get "text") }}
{{ range $link := $links }}
-{{ $href := printf "https://raw.githubusercontent.com/istio/istio/%s/%s" $branch (trim $link "@") }}
+{{ $target := trim $link "@" }}
+{{ if gt (len $target) 0 }}
+{{ $href := printf "https://raw.githubusercontent.com/istio/istio/%s/%s" $branch $target }}
{{ end }}
+{{ end }}