hugo-theme-relearn/layouts/_default/_markup/render-image.html

12 lines
412 B
HTML
Raw Normal View History

{{- $dest_url := urls.Parse .Destination }}
{{- $dest_path := $dest_url.Path }}
{{- $image := .Page.Resources.GetMatch $dest_path }}
{{- $url := .Destination | relURL }}
{{- if $image }}
{{- $url = $image.RelPermalink }}
{{- if $dest_url.RawQuery }}
{{- $url = printf "%s?%s" $url $dest_url.RawQuery }}
{{- end }}
{{- end }}
<img src="{{ $url }}" alt="{{ .Text }}"{{ with .Title}} title="{{ . }}"{{ end }}>