diff options
author | Christoph Cullmann <cullmann@kde.org> | 2021-02-18 21:44:01 +0100 |
---|---|---|
committer | Christoph Cullmann <cullmann@kde.org> | 2021-02-18 21:44:01 +0100 |
commit | e9ec93a471d9a753db01b682e75c52b32adf16f2 (patch) | |
tree | 5f6d9a2b7d90852965b6d24f9db6a9198570c03b /themes/LoveIt/layouts/partials/plugin/image.html | |
parent | bcafaafff80184537a3116de5341a8caa24d63f4 (diff) |
use LoveIt theme, self hosted
Diffstat (limited to 'themes/LoveIt/layouts/partials/plugin/image.html')
-rw-r--r-- | themes/LoveIt/layouts/partials/plugin/image.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/themes/LoveIt/layouts/partials/plugin/image.html b/themes/LoveIt/layouts/partials/plugin/image.html new file mode 100644 index 0000000..84a61b3 --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/image.html @@ -0,0 +1,38 @@ +{{- /* 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 -}} |