{{ $dest := .Destination }}
{{ $text := .PlainText }}
{{ $url := urls.Parse $dest }}

{{ $image := newScratch }}
{{ with $url.Scheme }}
  {{  $image.Set "resource" (resources.GetRemote $dest) }}
{{ else }}
  {{  $image.Set "resource" (resources.Get $dest) }}
{{ end }}

{{ if .Title }}
  <figure>
    {{ with ($image.Get "resource") }}
      {{ if eq .MediaType.SubType "svg" }}
        {{ .Content | safeHTML }}
      {{ else }}
        <img src="{{ .RelPermalink | safeURL }}" alt="{{ $text }}" width="{{ .Widt