Files
FixIt/layouts/_markup/render-image.html
T

28 lines
1.3 KiB
HTML

{{- /*
A Markdown image has three components: the image description, the image destination, and optionally the image title.
![white kitten](/images/kitten.jpg "A kitten!")
------------ ------------------ ---------
description destination title
------------ ------------------ ---------
.Text .Destination .Title
*/ -}}
{{- $params := .Page.Params | merge site.Params.page -}}
{{- $optim := slice
(dict "Process" "resize 800x webp" "descriptor" "800w")
(dict "Process" "resize 1200x webp" "descriptor" "1200w")
(dict "Process" "resize 1600x webp" "descriptor" "1600w")
-}}
{{- if .Title -}}
{{- $linked := ne $params.lightgallery false -}}
<figure>
{{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Caption" .Text "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
<figcaption class="image-caption">
{{- .Title | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- $linked := (eq $params.lightgallery "force") | or ($params.lightgallery | and (ne .Title "")) -}}
{{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- end -}}