1
Fork 0

Cleanup shortcode template

This commit is contained in:
Jake Howard 2018-08-19 16:35:53 +01:00
parent 5a4882634f
commit 4184aad3fe
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 2 additions and 15 deletions

View file

@ -1,5 +1,3 @@
{{ $style := default "btn-outline-dark" (.Get "style" )}} <a class="btn btn-outline-dark my-2" href='{{ .Get "src" }}'>
<a class="btn {{ $style }} my-2" href='{{ .Get "src" }}'>
{{ .Inner }} {{ .Inner }}
</a> </a>

View file

@ -1,18 +1,7 @@
{{ $original := .Page.Resources.GetMatch (.Get "src") }} {{ $original := .Page.Resources.GetMatch (.Get "src") }}
{{ $options := default "1000x" (.Get "options") }} {{ $options := default "1000x" (.Get "options") }}
{{ .Scratch.Set "image" $original }} {{ .Scratch.Set "image" ($original.Resize $options) }}
{{ $command := (default "Resize" (.Get "command")) }}
{{ if eq $command "Fit"}}
{{ .Scratch.Set "image" ($original.Fit $options) }}
{{ else if eq $command "Resize"}}
{{ .Scratch.Set "image" ($original.Resize $options) }}
{{ else if eq $command "Fill"}}
{{ .Scratch.Set "image" ($original.Fill $options) }}
{{ end }}
{{ define "img" }} {{ define "img" }}
{{ $image := .Scratch.Get "image" }} {{ $image := .Scratch.Get "image" }}