mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
link: backout backout #777
This commit is contained in:
parent
4e5fe8d90a
commit
06637ff16f
1 changed files with 15 additions and 17 deletions
|
@ -17,24 +17,22 @@
|
||||||
{{- $width := "auto" }}
|
{{- $width := "auto" }}
|
||||||
{{- $dest_url := urls.Parse $url }}
|
{{- $dest_url := urls.Parse $url }}
|
||||||
{{- $dest_path := $dest_url.Path }}
|
{{- $dest_path := $dest_url.Path }}
|
||||||
{{- $image := $page.Resources.GetMatch (path.Clean $dest_url.Path) }}
|
{{- $image := "" }}
|
||||||
{{- if not $image }}
|
{{- if not $dest_url.IsAbs }}
|
||||||
{{- $image = .Resources.GetMatch $dest_path }}
|
{{- with or ($page.Resources.Get $dest_url.Path) (resources.Get $dest_url.Path) }}
|
||||||
{{- end }}
|
{{- $image = . }}
|
||||||
{{- if not $image }}
|
|
||||||
{{- $image = .Resources.GetRemote $url }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if $image }}
|
|
||||||
{{- $url = $image.RelPermalink }}
|
|
||||||
{{- if $dest_url.RawQuery }}
|
|
||||||
{{- $url = printf "%s?%s" $url $dest_url.RawQuery }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- with $image }}
|
||||||
{{- if and (not $image) (not $dest_url.IsAbs) }}
|
{{- $url = $image.RelPermalink }}
|
||||||
{{- if eq $page.Site.Params.image.errorlevel "warning" }}
|
{{- with $dest_url.RawQuery }}
|
||||||
{{- warnf "%q: image '%s' is not a resource but linked anyways" $page.File.Filename .url }}
|
{{- $url = printf "%s?%s" $url . }}
|
||||||
{{- else if eq $page.Site.Params.image.errorlevel "error" }}
|
{{- end }}
|
||||||
{{- errorf "%q: image '%s' is not a resource" $page.File.Filename .url }}
|
{{- else }}
|
||||||
|
{{- if eq $page.Site.Params.image.errorlevel "warning" }}
|
||||||
|
{{- warnf "%q: image '%s' is not a resource but linked anyways" $page.File.Filename .url }}
|
||||||
|
{{- else if eq $page.Site.Params.image.errorlevel "error" }}
|
||||||
|
{{- errorf "%q: image '%s' is not a resource" $page.File.Filename .url }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $dest_url.RawQuery }}
|
{{- if $dest_url.RawQuery }}
|
||||||
|
|
Loading…
Reference in a new issue