Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (31 sloc) 1.13 KB
{{ $src := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
{{ .Scratch.Set "small" ($src.Resize "500x q90") }}
{{ .Scratch.Set "medium" ($src.Resize "800x q90") }}
{{ .Scratch.Set "medium2x" ($src.Resize "1400x q70") }}
{{ $small := .Scratch.Get "small" }}
{{ $medium := .Scratch.Get "medium" }}
{{ $medium2x := .Scratch.Get "medium2x" }}
{{ if .Get "caption" }}
<figure class="media">
{{ else }}
<div class="media">
{{ end }}
<div class="lazy-wrapper {{ with .Get "ratio"}}ratio ratio-{{.}}{{ end }}">
<img class="lazy"
src="{{ $src.RelPermalink }}"
data-zoom-src="{{ $src.RelPermalink }}"
sizes="100vw"
srcset='
{{ if ge $src.Width "500" }}{{ with $small.RelPermalink }}{{.}} 500w{{ end }} {{ end }}
{{ if ge $src.Width "800" }}{{ with $medium.RelPermalink }}, {{.}} 800w{{ end }} {{ end }}
{{ if ge $src.Width "1400" }}{{ with $medium2x.RelPermalink }}, {{.}} 1400w{{ end }}{{ end }}
'
{{ with .Get "alt" }}alt="{{ . }}"{{ end }}
>
</div>
{{ if .Get "caption" }}
<figcaption class="media-caption">{{ .Get "caption" }}</figcaption>
</figure>
{{ else }}
</div>
{{ end }}
You can’t perform that action at this time.