Skip to content

Commit 437c849

Browse files
committed
[web] Adapt figure shortcode to work with page resources as well.
Should fix CI previews.
1 parent 5c64bb4 commit 437c849

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

web/layouts/shortcodes/figure.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
{{ $src := .Get "src" }}
2+
{{ with .Page.Resources.GetMatch $src }}
3+
{{ $src = .Permalink }}
4+
{{ end }}
5+
16
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
27
{{- if .Get "link" -}}
38
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
49
{{- end -}}
5-
<img src="{{ .Get "src" }}"
10+
<img src="{{ $src }}"
611
{{- if or (.Get "alt") (.Get "caption") }}
712
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
813
{{- end -}}

0 commit comments

Comments
 (0)