24 lines
938 B
HTML
24 lines
938 B
HTML
{{- range $i, $_ := .content -}}
|
|
{{- $type := (default "link" .type) -}}
|
|
{{- $desc := .desc -}}
|
|
{{- if (eq (len $.content) 1) -}}
|
|
{{- $desc = (default $.text $desc) -}}
|
|
{{- else -}}
|
|
{{- if (and (not (isset . "desc")) (not (eq $type "text"))) -}}{{- errorf "Missing description for content %s" .data -}}{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- if (and (or (gt (len $.content) 1) (eq $type "text")) (eq $i 0)) -}}{{- $.text -}}: {{- end -}}
|
|
{{- if (gt $i 0) -}}, {{ end -}}
|
|
|
|
{{- if (eq $type "link") -}}
|
|
<a href="{{ .data }}" target="_blank" rel="noopener">{{ $desc }}</a>
|
|
{{- else if (eq $type "text") -}}
|
|
{{- .data -}}
|
|
{{- else if (eq $type "resource") -}}
|
|
{{- $resource := $.resources.GetMatch .data -}}
|
|
<a href="{{ $resource.RelPermalink }}">{{ $desc }}</a>
|
|
{{- else -}}
|
|
{{- errorf "Unknown content type %s" $type -}}
|
|
{{- end -}}
|
|
{{- end -}}
|