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: 72c74afb187edfbdb8ca5d0072307a27dff2d6e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
{{ if and .keyword (.context.Resources.ByType "image") }}
{{ .context.Scratch.Set "img" ((.context.Resources.ByType "image").GetMatch .keyword).Permalink }}
{{ else if or (hasPrefix .url "http://") (hasPrefix .url "https://") }}
{{ .context.Scratch.Set "img" (.url | absURL) }}
{{ else if resources.GetMatch .url }}
{{ .context.Scratch.Set "img" (resources.GetMatch .url).Permalink }}
{{ else if .url }}
{{ .context.Scratch.Set "img" (.url | absURL) }}
{{ end }}
{{ $img := .context.Scratch.Get "img" }}
{{ .context.Scratch.Delete "img" }}
{{ return $img }}