feat(helper/image): better detection of external image
By using strings.HasPrefix, it matches any images which name starts with http
This commit is contained in:
parent
19ff7a46bb
commit
3e18e165e0
@ -4,7 +4,8 @@
|
|||||||
<!-- If page has `image` field set -->
|
<!-- If page has `image` field set -->
|
||||||
{{ $result = merge $result (dict "exists" true) }}
|
{{ $result = merge $result (dict "exists" true) }}
|
||||||
|
|
||||||
{{ if strings.HasPrefix $imageField "http" }}
|
{{ $url := urls.Parse $imageField }}
|
||||||
|
{{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }}
|
||||||
<!-- Is a external image -->
|
<!-- Is a external image -->
|
||||||
{{ $result = merge $result (dict "src" $imageField) }}
|
{{ $result = merge $result (dict "src" $imageField) }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
Loading…
Reference in New Issue
Block a user