style(helper/image): code formatting
This commit is contained in:
parent
a2732a312a
commit
2079174aa9
@ -5,8 +5,8 @@
|
|||||||
{{ if $imageValue }}
|
{{ if $imageValue }}
|
||||||
<!-- If page has `image` field set -->
|
<!-- If page has `image` field set -->
|
||||||
{{ $result = merge $result (dict "exists" true) }}
|
{{ $result = merge $result (dict "exists" true) }}
|
||||||
|
|
||||||
{{ $url := urls.Parse $imageValue }}
|
{{ $url := urls.Parse $imageValue }}
|
||||||
|
|
||||||
{{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }}
|
{{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }}
|
||||||
<!-- Is a external image -->
|
<!-- Is a external image -->
|
||||||
{{ $result = merge $result (dict "permalink" $imageValue) }}
|
{{ $result = merge $result (dict "permalink" $imageValue) }}
|
||||||
@ -27,11 +27,11 @@
|
|||||||
{{ errorf "Failed loading image: %q" $imageValue }}
|
{{ errorf "Failed loading image: %q" $imageValue }}
|
||||||
{{ $result = merge $result (dict "exists" false) }}
|
{{ $result = merge $result (dict "exists" false) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ else if and (ne .Type nil) (index .Context.Site.Params.defaultImage .Type) }}
|
{{ else if and (ne .Type nil) (index .Context.Site.Params.defaultImage .Type) }}
|
||||||
<!-- Type arg is set, check for defaultImage setting -->
|
<!-- Type arg is set, check for defaultImage setting -->
|
||||||
|
|
||||||
{{ $defaultImageSetting := index .Context.Site.Params.defaultImage .Type }}
|
{{ $defaultImageSetting := index .Context.Site.Params.defaultImage .Type }}
|
||||||
|
|
||||||
{{ if $defaultImageSetting.enabled }}
|
{{ if $defaultImageSetting.enabled }}
|
||||||
@ -52,11 +52,12 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
<!-- External image -->
|
||||||
{{ $result = merge $result (dict "permalink" $defaultImageSetting.src) }}
|
{{ $result = merge $result (dict "permalink" $defaultImageSetting.src) }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ return $result }}
|
{{ return $result }}
|
Loading…
Reference in New Issue
Block a user