mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
theme: fix image urls if uglyURLs=true #370
This commit is contained in:
parent
b9e97bcc0b
commit
f2523234bd
1 changed files with 11 additions and 0 deletions
11
layouts/_default/_markup/render-image.html
Normal file
11
layouts/_default/_markup/render-image.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{{- $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 }}>
|
Loading…
Reference in a new issue