diff options
Diffstat (limited to 'layouts/partials/plugin/image.html')
-rw-r--r-- | layouts/partials/plugin/image.html | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/layouts/partials/plugin/image.html b/layouts/partials/plugin/image.html index 5a7f9d8..3a98b21 100644 --- a/layouts/partials/plugin/image.html +++ b/layouts/partials/plugin/image.html @@ -1,40 +1,22 @@ -{{- /* lazysizes and lightgallery.js */ -}} {{- $src := .Src -}} {{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}} {{- $src = .RelPermalink -}} {{- end -}} -{{- $small := .SrcSmall | default $src -}} -{{- with dict "Path" .SrcSmall "Resources" .Resources | partial "function/resource.html" -}} - {{- $small = .RelPermalink -}} -{{- end -}} - -{{- $large := .SrcLarge | default $src -}} -{{- with dict "Path" .SrcLarge "Resources" .Resources | partial "function/resource.html" -}} - {{- $large = .RelPermalink -}} -{{- end -}} - {{- $alt := .Alt | default $src -}} -{{- $loading := resources.Get "svg/loading.svg" | minify -}} -<div style="text-align: center"> + {{- if .Linked -}} - <a target="_blank" class="lightgallery" href="{{ $large | safeURL }}" title="{{ .Title | default $alt }}" data-thumbnail="{{ $small | safeURL }}"{{ with .Caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.Title }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .Rel }} rel="{{ . }}"{{ end }}> - <img - class="lazyload{{ with .Class }} {{ . }}{{ end }}" - src="{{ $loading.RelPermalink }}" - data-src="{{ .Src | safeURL }}" - data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 1.6x" + <a target="_blank" href="{{ .Src | safeURL }}" title="{{ .Title | default $alt }}" {{ with .Rel }} rel="{{ . }}"{{ end }}> + <img loading="lazy" decoding="async" data-sizes="auto" - alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} /> + src="{{ .Src | safeURL }}" + alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} + /> </a> {{- else -}} - <img - class="lazyload{{ with .Class }} {{ . }}{{ end }}" - src="{{ $loading.RelPermalink }}" - data-src="{{ .Src | safeURL }}" - data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 1.6x" - data-sizes="auto" - alt="{{ $alt }}" - title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} /> + <img loading="lazy" decoding="async" + src="{{ .Src | safeURL }}" + alt="{{ $alt }}" + title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} + /> {{- end -}} -</div>
\ No newline at end of file |