only link if href is not empty

This commit is contained in:
2019-07-08 16:24:22 +02:00
parent e35c9f76cd
commit 1bf6cd7c00

View File

@@ -8,7 +8,7 @@
<li>{{.desc}} <li>{{.desc}}
{{- $len := (len .links) -}} <!-- amount of elements under .links --> {{- $len := (len .links) -}} <!-- amount of elements under .links -->
{{- range $index, $element := .links -}} <!-- range over links, but keep index --> {{- range $index, $element := .links -}} <!-- range over links, but keep index -->
<a href="{{.href}}">{{.text}}</a> {{ with .href }}<a href="{{.}}">{{ end }}{{.text}}{{ with .href }}</a>{{end}}
{{- if ne (add $index 1) $len -}}, {{- end -}} <!-- only append comma if not last element (index starts with 0) --> {{- if ne (add $index 1) $len -}}, {{- end -}} <!-- only append comma if not last element (index starts with 0) -->
{{- end -}} {{- end -}}
{{- with .date }} ({{.}}){{ end }} {{- with .date }} ({{.}}){{ end }}