diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html new file mode 100644 index 0000000..5016146 --- /dev/null +++ b/layouts/shortcodes/img.html @@ -0,0 +1,21 @@ +{{ $img := dict }} +{{ with .Get "name" }} + {{ $img = $.Page.Resources.GetMatch . }} +{{ else }} + {{ errorf "No name given to img shortcode" }} +{{ end }} + +{{/* Space separated list of classes to apply to the tag */}} +{{ $classes := .Get "class" }} + +{{ $altText := $img.Params.alt | default (.Get "alt") }} +{{ if not $altText }} + {{ warnf "Image doesn't have alt text. %s" $img.Permalink }} +{{ end }} + +{{ $resizedImg := $img.Fit "1280x1280" }} +{{ $altText }}