mirror of
https://github.com/idanoo/m2.nz.git
synced 2024-11-30 04:05:13 +00:00
39 lines
1.8 KiB
HTML
39 lines
1.8 KiB
HTML
{{- /* 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 -}}
|
|
{{- if .Linked -}}
|
|
<a 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 }} 2x"
|
|
data-sizes="auto"
|
|
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 }} 2x"
|
|
data-sizes="auto"
|
|
alt="{{ $alt }}"
|
|
title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
|
|
{{- end -}}
|