add caption rendering

when render the image, also render the markdown caption
This commit is contained in:
Charles.Day 2024-12-24 14:03:10 +01:00 committed by GitHub
parent 087989e427
commit 57263cb4d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
{{- $Permalink := .Destination | relURL | safeURL -}}
{{- $alt := .PlainText | safeHTML -}}
{{- $title := .Title | safeHTML -}}
{{- $Width := 0 -}}
{{- $Height := 0 -}}
{{- $Srcset := "" -}}
@ -39,3 +40,6 @@
data-flex-basis="{{ div (mul $image.Width 240) $image.Height }}px"
{{ end }}
>
{{- if $title }}
<figcaption>{{ .Title }}</figcaption>
{{- end }}