diff --git a/layouts/shortcodes/resource.html b/layouts/shortcodes/resource.html new file mode 100644 index 0000000..4134d48 --- /dev/null +++ b/layouts/shortcodes/resource.html @@ -0,0 +1,28 @@ +{{ $original := .Page.Resources.GetByPrefix (.Get "src") }} +{{ $options := .Get "options" }} + +{{ .Scratch.Set "image" $original }} + +{{ if $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 }} +{{ end }} + +{{ $image := .Scratch.Get "image" }} + +{{ if .Inner }} +
+ +
+ {{ .Inner }} +
+
+{{ else }} + +{{ end }}