mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 03:03:09 +00:00
Revert "theme: optimize image loading #393"
This reverts commit c7f6cbf71b
.
This commit is contained in:
parent
1fd26744c6
commit
79e21d606a
1 changed files with 8 additions and 14 deletions
|
@ -7,19 +7,13 @@
|
||||||
{{- $height := "auto" }}
|
{{- $height := "auto" }}
|
||||||
{{- $width := "auto" }}
|
{{- $width := "auto" }}
|
||||||
{{- $dest_url := urls.Parse $url }}
|
{{- $dest_url := urls.Parse $url }}
|
||||||
{{- $dest_path := path.Clean $dest_url.Path }}
|
{{- $dest_path := $dest_url.Path }}
|
||||||
{{- $image := "" }}
|
{{- $image := $context.Resources.GetMatch $dest_path }}
|
||||||
{{- if ($dest_url.IsAbs) }}
|
{{- if not $image }}
|
||||||
{{/* this image does not belong to the site, get it from external */}}
|
{{- $image = .Resources.GetMatch $dest_path }}
|
||||||
{{- $image = resources.GetRemote $url }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- if not $image }}
|
||||||
{{- /* Get local page resource image. */}}
|
{{- $image = .Resources.GetRemote $url }}
|
||||||
{{- $image = $context.Resources.Get $dest_path }}
|
|
||||||
{{- if not $image }}
|
|
||||||
{{- /* Get local image from assets directory. */}}
|
|
||||||
{{- $dest_path := path.Clean $dest_url.Path }}
|
|
||||||
{{- $image = resources.Get $dest_path }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $image }}
|
{{- if $image }}
|
||||||
{{- $url = $image.RelPermalink }}
|
{{- $url = $image.RelPermalink }}
|
||||||
|
@ -32,7 +26,7 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $dest_url.RawQuery }}
|
{{- if $dest_url.RawQuery }}
|
||||||
{{- $classes = delimit (split ($dest_url.Query.Get "classes") ",") " " }}
|
{{- $classes = (replaceRE "\\s+" " " (replaceRE "," " " ($dest_url.Query.Get "classes") ) ) }}
|
||||||
{{- $featherlight = (ne ($dest_url.Query.Get "featherlight") "false") }}
|
{{- $featherlight = (ne ($dest_url.Query.Get "featherlight") "false") }}
|
||||||
{{- if or ($dest_url.Query.Get "height") ($dest_url.Query.Get "width") }}
|
{{- if or ($dest_url.Query.Get "height") ($dest_url.Query.Get "width") }}
|
||||||
{{- $height = "auto" }}
|
{{- $height = "auto" }}
|
||||||
|
|
Loading…
Reference in a new issue