LoveIt/layouts/partials/plugin/image.html

29 lines
1.4 KiB
HTML
Raw Normal View History

2020-02-24 10:00:39 +01:00
{{- /* lazysizes and lightgallery.js */ -}}
{{- $loading := resources.Get "svg/loading/normal.svg" | minify -}}
2020-02-27 13:14:40 +01:00
{{- $small := .src_s | default .src -}}
{{- $large := .src_l | default .src -}}
{{- $alt := .alt | default .src -}}
{{- if .linked -}}
<a class="lightgallery" href="{{ $large | safeURL }}" title="{{ .title | default $alt }}" data-thumbnail="{{ $small | safeURL }}"{{ with .caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.alt }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .rel }} rel="{{ . }}"{{ end }}>
2020-02-24 10:00:39 +01:00
<img
class="lazyload"
src="{{ $loading.RelPermalink | safeURL }}"
data-sizes="auto"
2020-02-27 13:14:40 +01:00
data-srcset="{{ $small | safeURL }}, {{ .src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-src="{{ .src | safeURL }}"
alt="{{ $alt }}"{{ with .height }} height="{{ . }}"{{ end }}{{ with .width }} width="{{ . }}"{{ end }} />
2020-02-24 10:00:39 +01:00
</a>
{{- else -}}
{{- if not .large -}}
{{- $loading = resources.Get "svg/loading/small.svg" | minify -}}
{{- end -}}
2020-02-24 10:00:39 +01:00
<img
class="lazyload"
src="{{ $loading.RelPermalink | safeURL }}"
data-sizes="auto"
2020-02-27 13:14:40 +01:00
data-srcset="{{ $small | safeURL }}, {{ .src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-src="{{ .src | safeURL }}"
alt="{{ $alt }}"
title="{{ .title | default $alt }}"{{ with .height }} height="{{ . }}"{{ end }}{{ with .width }} width="{{ . }}"{{ end }} />
2020-02-24 10:00:39 +01:00
{{- end -}}