mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-02-11 22:33:30 +08:00
add caption rendering
when render the image, also render the markdown caption
This commit is contained in:
parent
087989e427
commit
57263cb4d0
@ -1,6 +1,7 @@
|
|||||||
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
|
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
|
||||||
{{- $Permalink := .Destination | relURL | safeURL -}}
|
{{- $Permalink := .Destination | relURL | safeURL -}}
|
||||||
{{- $alt := .PlainText | safeHTML -}}
|
{{- $alt := .PlainText | safeHTML -}}
|
||||||
|
{{- $title := .Title | safeHTML -}}
|
||||||
{{- $Width := 0 -}}
|
{{- $Width := 0 -}}
|
||||||
{{- $Height := 0 -}}
|
{{- $Height := 0 -}}
|
||||||
{{- $Srcset := "" -}}
|
{{- $Srcset := "" -}}
|
||||||
@ -38,4 +39,7 @@
|
|||||||
data-flex-grow="{{ div (mul $image.Width 100) $image.Height }}"
|
data-flex-grow="{{ div (mul $image.Width 100) $image.Height }}"
|
||||||
data-flex-basis="{{ div (mul $image.Width 240) $image.Height }}px"
|
data-flex-basis="{{ div (mul $image.Width 240) $image.Height }}px"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
>
|
>
|
||||||
|
{{- if $title }}
|
||||||
|
<figcaption>{{ .Title }}</figcaption>
|
||||||
|
{{- end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user