style(helper/image): code formatting

This commit is contained in:
Jimmy Cai 2020-09-11 18:13:39 +02:00
parent a2732a312a
commit 2079174aa9
No known key found for this signature in database
GPG Key ID: 3EA408E527F37B18

View File

@ -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 }}
{{ end }}
{{ return $result }}