.Get $url.Path) -}}
      {{/* Images under assets directory */}}
      {{- $query := cond $url.RawQuery (printf "?%s" $url.RawQuery) "" -}}
      {{- $fragment := cond $url.Fragment (printf "#%s" $url.Fragment) "" -}}
      {{- $dest = printf "%s%s%s" .RelPermalink $query $fragment -}}
    {{- else -}}
      {{/* Images under static directory - keep absolute path */}}
      {{- $dest = $dest -}}
    {{- end -}}
  {{- else if and $isPage (not $startsWithRelative) -}}
    {{/* Images that are sibling to the 