Skip to content

Commit

Permalink
fix: render image as figure only when there is caption
Browse files Browse the repository at this point in the history
  • Loading branch information
HEIGE-PCloud committed Jun 6, 2024
1 parent de76eff commit b3b436f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
(dict "Process" "resize 1200x webp q75" "descriptor" "1200w")
(dict "Process" "resize 1600x webp q75" "descriptor" "1600w")
-}}

{{- if .Title -}}
<figure>
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" $lightgallery "Loading" "lazy" "Sizes" "auto" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- if .Title -}}
<figcaption class="image-caption">
{{- .Title | safeHTML -}}
</figcaption>
{{- end -}}
<figcaption class="image-caption">
{{- .Title | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- dict "Src" .Destination "Class" "tw-inline" "Title" .Text "Caption" .Title "Loading" "lazy" "Sizes" "auto" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- end -}}

0 comments on commit b3b436f

Please sign in to comment.