mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-27 00:56:19 +01:00
28 lines
1.4 KiB
HTML
28 lines
1.4 KiB
HTML
{{- /* lazysizes and lightgallery.js */ -}}
|
|
{{- $loading := resources.Get "svg/loading.svg" | minify -}}
|
|
{{- $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 }}>
|
|
<img
|
|
class="lazyload"
|
|
src="{{ $loading.RelPermalink | safeURL }}"
|
|
data-sizes="auto"
|
|
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 }} />
|
|
</a>
|
|
{{- else -}}
|
|
{{- if not .large -}}
|
|
{{- $loading = resources.Get "svg/loading.small.svg" | minify -}}
|
|
{{- end -}}
|
|
<img
|
|
class="lazyload"
|
|
src="{{ $loading.RelPermalink | safeURL }}"
|
|
data-sizes="auto"
|
|
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 }} />
|
|
{{- end -}}
|