30 lines
847 B
HTML
30 lines
847 B
HTML
{{- $path := .path -}}
|
|
{{- $caption := .caption -}}
|
|
{{- $alt := default .caption .alt -}}
|
|
|
|
{{- if $path -}}
|
|
{{- $isRemote := strings.HasPrefix $path "http" -}}
|
|
{{- $image := cond $isRemote (resources.GetRemote $path) (resources.Get $path) -}}
|
|
|
|
{{- if $image -}}
|
|
<figure class="image gallery">
|
|
<a
|
|
href="{{- $image.RelPermalink -}}"
|
|
data-pswp-width="{{- $image.Width -}}"
|
|
data-pswp-height="{{- $image.Height -}}"
|
|
>
|
|
<img
|
|
src="{{- $image.RelPermalink -}}"
|
|
width="{{- $image.Width -}}"
|
|
height="{{- $image.Height -}}"
|
|
{{ with $caption }}title="{{- . -}}"{{ end }}
|
|
{{ with $alt }}alt="{{- . -}}"{{ end }}
|
|
/>
|
|
</a>
|
|
{{ with $caption }}
|
|
<figcaption>{{ . }}</figcaption>
|
|
{{ end }}
|
|
</figure>
|
|
{{- end -}}
|
|
{{- end -}}
|