This commit is contained in:
2025-07-06 19:45:00 -05:00
parent 8fafc843ef
commit e0d2c536e4
3 changed files with 33 additions and 11 deletions

View File

@ -1,8 +1,12 @@
{{ with .Title }}
<figure>
{{ partial "embed-resource.html" ($.Page.Resources.Get $.Destination) }}
<figcaption>{{ . }}</figcaption>
</figure>
{{ else }}
{{/* TODO: should we use .PageInner */}}
{{ partial "embed-resource.html" (.Page.Resources.Get .Destination) }}
{{ with .Title }}
{{ errorf "%q" . }}
{{ end }}
{{ with .Attributes }}
{{/* FIXME: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_markup/render-image.html */}}
{{ errorf "%q" . }}
{{ end }}
{{ with .Text }}
{{ errorf "%q" . }}
{{ end }}

View File

@ -1,8 +1,17 @@
<p>
<figure>
{{ with .Get "src" }}
{{ with $.Page.Resources.Get . }}
{{ partial "embed-resource.html" . }}
{{ with .Title }}
<figcaption>{{ . | markdownify }}</figcaption>
{{ end }}
{{ else }}
{{ errorf "resource %q not found" . }}
{{ end }}
{{ else }}
{{ .Inner }}
{{ with .Get "caption" }}
<figcaption>{{ . }}</figcaption>
<figcaption>{{ . | markdownify }}</figcaption>
{{ end }}
{{ end }}
</figure>
</p>

View File

@ -0,0 +1,9 @@
{{ with .Get 0 }}
{{ with $.Page.Resources.Get . }}
{{ partial "embed-resource.html" . }}
{{ else }}
{{ errorf "resource %q not found" . }}
{{ end }}
{{ else }}
{{ errorf "resource name not provided as first parameter" }}
{{ end }}