mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
28 lines
1.3 KiB
HTML
28 lines
1.3 KiB
HTML
{{- /*
|
|
A Markdown image has three components: the image description, the image destination, and optionally the image title.
|
|
|
|

|
|
------------ ------------------ ---------
|
|
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 -}}
|