Files
mehl.mx/themes/hugo-sustain/layouts/shortcodes/links.html

27 lines
1.5 KiB
HTML
Raw Normal View History

2019-03-18 16:50:46 +01:00
{{- $type := .Get "type" -}} <!-- e.g. "media" -->
{{- $data := .Site.Data.links -}}
{{- if $type -}}
{{- $data = where $data "type" $type -}}
{{ end }}
2020-02-27 11:49:55 +01:00
<ul>
2019-03-18 16:50:46 +01:00
{{- range sort $data "date" "desc" }}
{{- $tags := slice -}}
{{- range .lang }}{{ $tags = $tags | append . }}{{ end -}}
{{- range .tags }}{{ $tags = $tags | append . }}{{ end -}}
2024-09-03 10:03:34 +02:00
<li class="link" tags="{{ delimit $tags ' ' }}">
{{ .desc -}}&nbsp;&nbsp;
{{- $len := (len .links) -}} <!-- amount of elements under .links -->
2020-02-27 11:49:55 +01:00
{{- range $index, $element := .links -}} <!-- range over links, but keep index -->
{{- with .href }}<a href="{{.}}" target="_blank">{{ end }}{{.text}}{{ with .href }}</a>{{end}}
2021-08-08 10:37:22 +02:00
{{- if ne (add $index 1) $len -}},&#32;{{- end -}} <!-- only append comma if not last element (index starts with 0) -->
2020-02-27 14:51:27 +01:00
{{- end -}}
2020-02-27 11:49:55 +01:00
{{- if or (.video) (.audio) (.slides) }},{{ end -}}
{{ with .video }}&nbsp;<a href="{{ . }}" target="_blank" aria-label="Video Recording"><i class="fas fa-video" aria-hidden="true" title="Video Recording"></i></a>{{ end }}
{{- with .audio }}&nbsp;<a href="{{ . }}" target="_blank" aria-label="Audio Recording"><i class="fas fa-microphone" aria-hidden="true" title="Audio Recording"></i></a>{{ end }}
{{ with .slides }}&nbsp;<a href="{{ . }}" target="_blank" aria-label="Slides"><i class="fas fa-desktop" aria-hidden="true" title="Slides"></i></a>{{ end -}}
{{- with .date }} ({{.}}){{ end -}}
{{ range $tags }}&nbsp;<span class="label label-success">{{ . }}</span>{{ end -}}
2020-02-27 11:49:55 +01:00
</li>
2019-03-18 16:50:46 +01:00
{{ end }}
2020-02-27 11:49:55 +01:00
</ul>