Files
patek.cz/themes/patek/layouts/partials/linkedContent.html
T
Vojtěch Káně 96a0148a1f Fix partials/linkedContent
There was a forgotten debug constant
2020-09-07 14:22:49 +02:00

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 -}}:&nbsp{{- 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 -}}