diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index a79cddf03..9e09b98a5 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,10 +1,16 @@ -{{- if .Title -}} +{{ $figcap := or .Title .Text }} +{{ $caption := or .Text " " }} +{{- if eq $figcap $caption -}} + {{ $caption = " " }} +{{- end -}} + +{{- if $figcap -}}
- {{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}} + {{- dict "Src" .Destination "Title" $figcap "Caption" $caption "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
- {{- .Title | safeHTML -}} + {{- $figcap | safeHTML -}}
{{- else -}} - {{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/image.html" -}} + {{- dict "Src" .Destination "Title" (path.Base .Destination) "Resources" .Page.Resources | partial "plugin/image.html" -}} {{- end -}}