Jake Howard
9705daade3
Turns out this had been broken since Hugo 0.55, and I never worked out why... https://gohugo.io/content-management/shortcodes/#shortcodes-with-markdown
20 lines
592 B
HTML
20 lines
592 B
HTML
{{ $original := .Page.Resources.GetMatch (.Get "src") }}
|
|
{{ $options := default "1000x" (.Get "options") }}
|
|
|
|
{{ .Scratch.Set "image" ($original.Resize $options) }}
|
|
|
|
{{ define "img" }}
|
|
{{ $image := .Scratch.Get "image" }}
|
|
<img src='{{ $image.RelPermalink }}' class='{{ .Get "class" }}' alt="{{ .Inner | plainify }}" style="max-width: 60%;" />
|
|
{{ end }}
|
|
|
|
{{ if .Inner }}
|
|
<figure class="text-center">
|
|
{{ template "img" . }}
|
|
<figcaption class="text-center">
|
|
<small>{{ .Inner | markdownify }}</small>
|
|
</figcaption>
|
|
</figure>
|
|
{{ else }}
|
|
{{ template "img" . }}
|
|
{{ end }}
|