17 lines
582 B
HTML
17 lines
582 B
HTML
{{- $img := "" }}
|
|
{{- $validKeyword := false }}
|
|
{{- if .keyword }}
|
|
{{- if (.context.Resources.ByType "image").GetMatch .keyword }}
|
|
{{- $validKeyword = true}}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if $validKeyword }}
|
|
{{- $img = ((.context.Resources.ByType "image").GetMatch .keyword).Permalink }}
|
|
{{- else if or (hasPrefix .url "//") (or (hasPrefix .url "http://") (hasPrefix .url "https://")) }}
|
|
{{- $img = (.url | absURL) }}
|
|
{{- else if resources.GetMatch .url }}
|
|
{{- $img = (resources.GetMatch .url).Permalink }}
|
|
{{- else if .url }}
|
|
{{- $img = (.url | absURL) }}
|
|
{{- end }}
|
|
{{- return $img }} |