6 Commits

Author SHA1 Message Date
5afaf2ce3e Fix fallback to resource title for figure caption 2025-07-27 03:33:44 -05:00
486fa65ad6 Finish video embed support 2025-07-27 03:33:25 -05:00
f371afe529 Support using src with custom caption parameter in figure shortcode 2025-07-27 02:34:44 -05:00
8f79d2af3a Allow using positional parameter for figure caption 2025-07-27 01:44:08 -05:00
d6cb2c12c8 Fix markdown rendering on caption of featured image 2025-07-27 01:43:59 -05:00
2fa53d1f2c Remove render-image override
We can just use the resource shortcode in content files
2025-07-27 00:44:45 -05:00
5 changed files with 12 additions and 24 deletions

View File

@@ -4,8 +4,6 @@ markup:
lineNos: true
goldmark:
parser:
# don't put <p> around ![]() image in markdown (used to embed any resource now)
wrapStandAloneImageWithinParagraph: false
attribute:
block: true
# this is enabled by default already

View File

@@ -1,12 +0,0 @@
{{/* 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

@@ -6,12 +6,14 @@
<img src="{{ .Permalink }}" {{ with .Params.alt }}alt="{{ . }}"{{ end }} />
{{ else if eq .ResourceType "video" }}
<video controls preload="metadata">
{{/* FIXME
<source src="{{ .Permalink }}" {{ with .Params.alt }}alt="{{ . }}"{{ end }} />
*/}}
{{ with .Params.alt }}
{{ warnf "video does not support alt text, '%s'" . }}
{{ end }}
<source src="{{ .Permalink }}" />
{{ i18n "browser_no_video_support" }}
<a href="{{ .Permalink }}" target="_blank" rel="noopener">
{{ i18n "browser_no_video_support_link" }}
</a>
</video>
{{ else }}
{{/* TODO: could consider implementing more types, listed at:

View File

@@ -3,7 +3,7 @@
<figure>
{{ partial "embed-resource.html" . }}
{{ with .Title }}
<figcaption>{{ . }}</figcaption>
<figcaption>{{ . | markdownify }}</figcaption>
{{ end }}
</figure>
</div>

View File

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