diff options
author | Jimmy Cai <jimmehcai@gmail.com> | 2020-09-11 19:13:39 +0300 |
---|---|---|
committer | Jimmy Cai <jimmehcai@gmail.com> | 2020-09-11 19:13:39 +0300 |
commit | 2079174aa951d66d80597d5b8a18d1f151718284 (patch) | |
tree | 125b6b47f2d8714e455744778581879246d5d0a7 | |
parent | a2732a312a0ab8e2533eaf9c571d521354690b4b (diff) |
style(helper/image): code formatting
-rw-r--r-- | layouts/partials/helper/image.html | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/layouts/partials/helper/image.html b/layouts/partials/helper/image.html index f73e985..5276f2e 100644 --- a/layouts/partials/helper/image.html +++ b/layouts/partials/helper/image.html @@ -5,8 +5,8 @@ {{ if $imageValue }} <!-- If page has `image` field set --> {{ $result = merge $result (dict "exists" true) }} - {{ $url := urls.Parse $imageValue }} + {{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }} <!-- Is a external image --> {{ $result = merge $result (dict "permalink" $imageValue) }} @@ -27,11 +27,11 @@ {{ errorf "Failed loading image: %q" $imageValue }} {{ $result = merge $result (dict "exists" false) }} {{ end }} + {{ end }} {{ else if and (ne .Type nil) (index .Context.Site.Params.defaultImage .Type) }} <!-- Type arg is set, check for defaultImage setting --> - {{ $defaultImageSetting := index .Context.Site.Params.defaultImage .Type }} {{ if $defaultImageSetting.enabled }} @@ -52,11 +52,12 @@ {{ end }} {{ else }} - + <!-- External image --> {{ $result = merge $result (dict "permalink" $defaultImageSetting.src) }} - {{ end }} + {{ end }} + {{ end }} {{ return $result }}
\ No newline at end of file |