19 lines
727 B
HTML
19 lines
727 B
HTML
|
|
{{- $type := .Get "type" -}} <!-- e.g. "media" -->
|
|||
|
|
{{- $data := .Site.Data.links -}}
|
|||
|
|
{{- if $type -}}
|
|||
|
|
{{- $data = where $data "type" $type -}}
|
|||
|
|
{{ end }}
|
|||
|
|
{{- range sort $data "date" "desc" }}
|
|||
|
|
<ul>
|
|||
|
|
<li>{{.desc}} –
|
|||
|
|
{{- $len := (len .links) -}} <!-- amount of elements under .links -->
|
|||
|
|
{{- range $index, $element := .links -}} <!-- range over links, but keep index -->
|
|||
|
|
<a href="{{.href}}">{{.text}}</a>
|
|||
|
|
{{- if ne (add $index 1) $len -}}, {{- end -}} <!-- only append comma if not last element (index starts with 0) -->
|
|||
|
|
{{- end -}}
|
|||
|
|
{{- with .date }} ({{.}}){{ end }}
|
|||
|
|
{{ range .tags }}<span class="label label-success">{{ . }}</span> {{ end }}
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
{{ end }}
|