Fix fallback to resource title for figure caption

This commit is contained in:
2025-07-27 03:33:44 -05:00
parent 486fa65ad6
commit 5afaf2ce3e

View File

@@ -1,6 +1,8 @@
<figure> <figure>
{{ $resource_title := "" }}
{{ with .Get "src" }} {{ with .Get "src" }}
{{ with $.Page.Resources.Get . }} {{ with $.Page.Resources.Get . }}
{{ $resource_title = .Title }}
{{ partial "embed-resource.html" . }} {{ partial "embed-resource.html" . }}
{{ else }} {{ else }}
{{ errorf "resource %q not found" . }} {{ errorf "resource %q not found" . }}
@@ -9,7 +11,7 @@
{{ .Inner }} {{ .Inner }}
{{ end }} {{ end }}
{{ with or (.Get "caption") (.Get 0) .Title }} {{ with or (.Get "caption") (.Get 0) $resource_title }}
<figcaption>{{ . | markdownify }}</figcaption> <figcaption>{{ . | markdownify }}</figcaption>
{{ end }} {{ end }}
</figure> </figure>