only link if href is not empty
This commit is contained in:
@@ -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 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user