Browse Source

only link if href is not empty

max.mehl 2 weeks ago
parent
commit
1bf6cd7c00
No account linked to committer's email address
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      layouts/shortcodes/links.html

+ 1
- 1
layouts/shortcodes/links.html View File

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

Loading…
Cancel
Save