Skip to content

Commit

Permalink
[web] Adapt figure shortcode to work with page resources as well.
Browse files Browse the repository at this point in the history
Should fix CI previews.
  • Loading branch information
bilke committed Oct 26, 2023
1 parent 5c64bb4 commit 437c849
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{{ $src := .Get "src" }}
{{ with .Page.Resources.GetMatch $src }}
{{ $src = .Permalink }}
{{ end }}

<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end -}}
<img src="{{ .Get "src" }}"
<img src="{{ $src }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
Expand Down

0 comments on commit 437c849

Please sign in to comment.