blog/layouts/shortcodes/img.html

11 lines
433 B
HTML
Raw Permalink Normal View History

2023-03-25 17:47:12 +00:00
{{ $imageName := .Get "img" }}
{{ $images := .Page.Resources.Match $imageName }}
{{ $image := index $images 0 }}
{{ $fill := .Get "fill" }}
{{ if $fill }}{{ $image = $image.Fill $fill }}{{ end }}
{{ $fit := .Get "fit" }}
{{ if $fit }}{{ $image = $image.Fit $fit }}{{ end }}
{{ $class := .Get "class" }}
{{ $style := .Get "style" }}
{{ print "<img class='" $class "' style='" $style "' src='" $image.RelPermalink "'>" | markdownify}}