kobel/layouts/_default/_markup/render-image.html

15 lines
491 B
HTML

{{ $caption := .Title }}
{{ $alt := .Text }}
{{ $img := .Page.Resources.GetMatch .Destination }}
{{ if not $img }}
{{ $img = resources.Get .Destination }}
{{ if not $img }}
{{ $img := resources.GetRemote .Destination | resources.Copy (path.Join "images" (path.Base .Destination)) }}
{{ end }}
{{ end }}
{{ with $img }}
{{ partial "components/image.html" (dict "url" .RelPermalink "alt" $alt "width" .Width "height" .Height) }}
<p class="caption">{{ $caption }}</p>
{{ end }}