Welcome to mirror list, hosted at ThFree Co, Russian Federation.

get_image.html « partials « layouts - github.com/wangchucheng/hugo-eureka.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 31e833c3fe5963175cc8929f6589b77bf5736975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{{- $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 resources.GetMatch .url }}
{{- $img = (resources.GetMatch .url).Permalink }}
{{- else if .url }}
{{- $img = (.url | absURL) }}
{{- end }}
{{- return $img }}