Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (43 sloc) 1.34 KB
{{ $altText := .Get "alt"}}
{{ $caption := .Get "caption"}}
{{ with $.Page.Resources.GetMatch (.Get "src") }}
<figure>
<a href="{{.RelPermalink}}">
<img
srcset="
{{ (.Resize "320x").RelPermalink }} 320w,
{{ (.Resize "600x").RelPermalink }} 600w,
{{ (.Resize "1200x").RelPermalink }} 1200w,
{{ (.Resize "1800x").RelPermalink }} 2x"
sizes="(max-width: 320px) 320w,
(max-width: 600px) 600w,
(max-width: 1200px) 1200w,
2x"
src="{{ (.Resize "1200x").RelPermalink }}" alt="{{$altText}}"/>
</a>
{{ with $caption }}
<figcaption><h4>{{ . }}</h4></figcaption>
{{ end }}
</figure>
{{ else }}
{{ with resources.Get (.Get "src") }}
<figure>
<a href="{{.RelPermalink}}">
<img
srcset="
{{ (.Resize "320x").RelPermalink }} 320w,
{{ (.Resize "600x").RelPermalink }} 600w,
{{ (.Resize "1200x").RelPermalink }} 1200w,
{{ (.Resize "1800x").RelPermalink }} 2x"
sizes="(max-width: 320px) 320w,
(max-width: 600px) 600w,
(max-width: 1200px) 1200w,
2x"
src="{{ (.Resize "1200x").RelPermalink }}" alt="{{$altText}}"/>
</a>
{{ with $caption }}
<figcaption><h4>{{ . }}</h4></figcaption>
{{ end }}
</figure>
{{ end }}
{{ end }}