My personal website built with Hugo https://mehl.mx
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

links.html 727B

123456789101112131415161718
  1. {{- $type := .Get "type" -}} <!-- e.g. "media" -->
  2. {{- $data := .Site.Data.links -}}
  3. {{- if $type -}}
  4. {{- $data = where $data "type" $type -}}
  5. {{ end }}
  6. {{- range sort $data "date" "desc" }}
  7. <ul>
  8. <li>{{.desc}} –
  9. {{- $len := (len .links) -}} <!-- amount of elements under .links -->
  10. {{- range $index, $element := .links -}} <!-- range over links, but keep index -->
  11. <a href="{{.href}}">{{.text}}</a>
  12. {{- if ne (add $index 1) $len -}}, {{- end -}} <!-- only append comma if not last element (index starts with 0) -->
  13. {{- end -}}
  14. {{- with .date }} ({{.}}){{ end }}
  15. {{ range .tags }}<span class="label label-success">{{ . }}</span>&nbsp;{{ end }}
  16. </li>
  17. </ul>
  18. {{ end }}