epub/layouts/shortcodes/image.html

13 lines
412 B
HTML
Raw Permalink Normal View History

2021-02-03 05:28:19 -05:00
{{ $src := .Get "src" }}{{ $src = print "*" $src "*" -}}
{{- $size := .Site.Params.imgsize -}}
{{- $caption := .Get "caption" -}}
{{- with $.Page.Resources.Match $src -}}
{{- range first 1 . -}}
{{- $scaled := .Resize $size -}}
<figure>
<img src="{{ $scaled.RelPermalink }}" alt="{{ $caption | default $.Page.Title }}" />
<figcaption>{{ $caption }}</figcaption>
</figure>
{{- end -}}
{{- end -}}