blob: 9e9b6dcd735702059d7b76d344ef41f5eac3f981 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
{{$imageBundle := .page.Site.GetPage "uploads"}}
{{with .image}}
{{$path := .url}}
{{$media := .media}}
{{$alt := .alt}}
{{$srcset := slice}}
{{with .params}}
{{range (last (sub (len .) 1) .)}}
{{$image := partial "func/GetImage" (dict "bundle" $imageBundle "path" $path "cmd" .cmd "options" .options)}}
{{$srcset = $srcset | append (print ($image.RelPermalink) " " $image.Width "w")}}
{{end}}
{{end}}
<picture{{with .class}} class="{{.}}"{{end}}>
{{with $srcset}}
<source{{with $media}} media="{{.}}"{{end}} srcset="{{delimit $srcset ", "}}" />
{{end}}
{{if .params}}
{{with (index .params 0)}}
{{$image := partial "func/GetImage" (dict "bundle" $imageBundle "path" $path "cmd" .cmd "options" .options)}}
<img src="{{$image.RelPermalink | default ($path | relURL)}}" alt="{{$alt}}" />
{{end}}
{{else}}
<img src="{{$path | relURL}}" alt="{{$alt}}" />
{{end}}
</picture>
{{end}}
|