mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-12-12 01:41:11 +01:00
30 lines
1.3 KiB
HTML
30 lines
1.3 KiB
HTML
{{- /* lazysizes and lightgallery.js */ -}}
|
|
{{- $small := .src_s | default .src -}}
|
|
{{- $large := .src_l | default .src -}}
|
|
{{- $loading := resources.Get "svg/loading.svg" | minify -}}
|
|
{{- if not .src | and .src_s -}}
|
|
{{- $loading = resources.Get "svg/loading.small.svg" | minify -}}
|
|
{{- end -}}
|
|
{{- if .lightgallery -}}
|
|
<a class="lightgallery" href="{{ $large | safeURL }}" title="{{ .description }}" data-thumbnail="{{ $small | safeURL }}"{{ if .title }} data-sub-html="<h2>{{ .title }}</h2><p>{{ .description }}</p>"{{ 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="{{ .title | default .description }}" />
|
|
</a>
|
|
{{- with .scratch -}}
|
|
{{- .Set "lightgallery" true -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
<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="{{ .title | default .description }}"
|
|
title="{{ .description }}" />
|
|
{{- end -}}
|