2019-02-12 23:25:13 +01:00
|
|
|
{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get "img")) }}
|
|
|
|
{{ $new := "" }}
|
|
|
|
|
|
|
|
{{ if eq (.Get "command") "Fit" }}
|
|
|
|
{{ $new = $original.Fit (.Get "options") }}
|
|
|
|
{{ else if eq (.Get "command") "Fill" }}
|
|
|
|
{{ $new = $original.Fill (.Get "options") }}
|
|
|
|
{{ else if eq (.Get "command") "Resize" }}
|
|
|
|
{{ $new = $original.Resize (.Get "options") }}
|
|
|
|
{{ else if eq (.Get "command") "Original" }}
|
|
|
|
{{ $new = $original }}
|
|
|
|
{{ else }}
|
|
|
|
{{ errorf "Invalid image processing command: Must be one of Fit, Fill, Resize, Original." }}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<figure role="group" aria-describedby="caption-{{ (.Get "caption") | md5 }}">
|
|
|
|
<a href="{{ $original.Permalink }}" class="img-link">
|
|
|
|
<img src="{{ $new.Permalink }}">
|
|
|
|
</a>
|
|
|
|
<figcaption id="caption-{{ (.Get "caption") | md5 }}">
|
|
|
|
{{ (.Get "caption") | markdownify }}
|
2017-11-02 16:39:45 +01:00
|
|
|
</figcaption>
|
|
|
|
</figure>
|