Welcome to mirror list, hosted at ThFree Co, Russian Federation.

image.html « plugin « partials « layouts - github.com/uPagge/uBlogger.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5a7f9d8462145260beff64973b5fdeeb424651d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{{- /* 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"
            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 }} 1.6x"
        data-sizes="auto"
        alt="{{ $alt }}"
        title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
{{- end -}}
</div>