diff options
Diffstat (limited to 'layouts/shortcodes/figureCupper.html')
-rw-r--r-- | layouts/shortcodes/figureCupper.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/layouts/shortcodes/figureCupper.html b/layouts/shortcodes/figureCupper.html new file mode 100644 index 0000000..90bf2e6 --- /dev/null +++ b/layouts/shortcodes/figureCupper.html @@ -0,0 +1,28 @@ +{{ $img := .Get "img" }} +{{ $caption := .Get "caption" }} +{{ $command := .Get "command" }} +{{ $options := .Get "options" }} + +{{ $original := .Page.Resources.GetMatch (printf "*%s*" $img) }} +{{ $new := "" }} + +{{ if eq $command "Fit" }} + {{ $new = $original.Fit $options }} +{{ else if eq $command "Fill" }} + {{ $new = $original.Fill $options }} +{{ else if eq $command "Resize" }} + {{ $new = $original.Resize $options }} +{{ else if eq $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-{{ $caption | md5 }}"> + <a href="{{ $original.Permalink }}" class="img-link"> + <img src="{{ $new.Permalink }}"> + </a> + <figcaption id="caption-{{ $caption | md5 }}"> + {{ $caption | markdownify }} + </figcaption> +</figure> |