- {{ if $image.local }}
- {{- $imageRaw := $image.src | resources.Fingerprint "md5" -}}
+ {{ if $image.resource }}
+ {{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
{{- $thumbnail := $imageRaw.Fill .size -}}
{{ else }}
-
+
{{ end }}
{{ end }}
diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html
index 0e3ff50..9ba972c 100644
--- a/layouts/partials/article/components/details.html
+++ b/layouts/partials/article/components/details.html
@@ -4,8 +4,8 @@
{{ with $categories := .Params.categories }}
- {{ if $image.local }}
- {{- $tablet := $image.src.Resize "1024x" -}}
- {{- $desktop := $image.src.Resize "2000x" -}}
+ {{ if $image.resource }}
+ {{- $tablet := $image.resource.Resize "1024x" -}}
+ {{- $desktop := $image.resource.Resize "2000x" -}}
{{ else }}
-
+
{{ end }}
{{ end }}
diff --git a/layouts/partials/head/opengraph.html b/layouts/partials/head/opengraph.html
index 654c55c..26c987a 100644
--- a/layouts/partials/head/opengraph.html
+++ b/layouts/partials/head/opengraph.html
@@ -42,13 +42,9 @@
{{ $image := partial "helper/image" . }}
{{- if $image.exists -}}
- {{ $imagePermalink := $image.src }}
- {{ if $image.local }}
- {{ $imagePermalink = absURL $image.src.RelPermalink }}
- {{ end }}
-
-
+
+
{{- else if .Site.Params.opengraph.defaultImage -}}
{{ $image := resources.Get .Site.Params.opengraph.defaultImage }}
diff --git a/layouts/partials/helper/image.html b/layouts/partials/helper/image.html
index c8371b4..3a78d6d 100644
--- a/layouts/partials/helper/image.html
+++ b/layouts/partials/helper/image.html
@@ -1,4 +1,4 @@
-{{ $result := dict "exists" false "local" false "isDefault" false }}
+{{ $result := dict "exists" false "permalink" nil "resource" nil "isDefault" false }}
{{ $imageField := .Params.image }}
{{ if $imageField }}
@@ -7,19 +7,19 @@
{{ $url := urls.Parse $imageField }}
{{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }}
- {{ $result = merge $result (dict "src" $imageField) }}
+ {{ $result = merge $result (dict "permalink" $imageField) }}
{{ else }}
{{ $pageResourceImage := .Resources.GetMatch (printf "%s" ($imageField | safeURL)) }}
{{ $siteResourceImage := resources.GetMatch (printf "%s" ($imageField | safeURL)) }}
{{ if $pageResourceImage }}
- {{ $result = merge $result (dict "local" true) }}
- {{ $result = merge $result (dict "src" $pageResourceImage) }}
+ {{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }}
+ {{ $result = merge $result (dict "resource" $pageResourceImage) }}
{{ else if $siteResourceImage }}
- {{ $result = merge $result (dict "local" true) }}
- {{ $result = merge $result (dict "src" $siteResourceImage) }}
+ {{ $result = merge $result (dict "permalink" $siteResourceImage.RelPermalink) }}
+ {{ $result = merge $result (dict "resource" $siteResourceImage) }}
{{ else }}
{{ errorf "Failed loading image: %q" $imageField }}