59 lines
1.1 KiB
HTML
59 lines
1.1 KiB
HTML
<div class="image-container">
|
|
{{ $src := .src }} {{ $alt := .Text | default "image" }} {{ $title := .Title }}
|
|
{{ $isRemote := strings.HasPrefix $src "http" }} {{ if $isRemote }} {{ with
|
|
resources.GetRemote $src }} {{ if eq .MediaType.SubType "svg" }}
|
|
<img
|
|
src="{{ $src }}"
|
|
alt="{{ $alt }}"
|
|
{{
|
|
if
|
|
$title
|
|
}}title="{{ $title }}"
|
|
{{
|
|
end
|
|
}}
|
|
loading="lazy"
|
|
/>
|
|
{{ else }} {{ $webp := .Fit "300x300 webp" | fingerprint }}
|
|
<img
|
|
src="{{ $webp.RelPermalink }}"
|
|
alt="{{ $alt }}"
|
|
{{
|
|
if
|
|
$title
|
|
}}title="{{ $title }}"
|
|
{{
|
|
end
|
|
}}
|
|
loading="lazy"
|
|
/>
|
|
{{ end }} {{ end }} {{ else }} {{ with resources.Get $src }} {{ if eq
|
|
.MediaType.SubType "svg" }}
|
|
<img
|
|
src="{{ $src }}"
|
|
alt="{{ $alt }}"
|
|
{{
|
|
if
|
|
$title
|
|
}}title="{{ $title }}"
|
|
{{
|
|
end
|
|
}}
|
|
loading="lazy"
|
|
/>
|
|
{{ else }} {{ $resized := .Fit "300x300 webp" }}
|
|
<img
|
|
src="{{ $resized.RelPermalink }}"
|
|
alt="{{ $alt }}"
|
|
{{
|
|
if
|
|
$title
|
|
}}title="{{ $title }}"
|
|
{{
|
|
end
|
|
}}
|
|
loading="lazy"
|
|
/>
|
|
{{ end }} {{ end }} {{ end }}
|
|
</div>
|