aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2022-04-08 05:33:06 -0400
committerThedro Neely <thedroneely@gmail.com>2022-04-08 05:33:06 -0400
commit1ef5f6201dd8262dfd445d5c61f5ac0b454e4d4a (patch)
tree750b02489c29c015f2cbf98669db0a80b0da1fb7
parentabdf83d9f741b609d93dde0099d94bd2858ce4d5 (diff)
downloadthedroneely.com-1ef5f6201dd8262dfd445d5c61f5ac0b454e4d4a.tar.gz
thedroneely.com-1ef5f6201dd8262dfd445d5c61f5ac0b454e4d4a.tar.bz2
thedroneely.com-1ef5f6201dd8262dfd445d5c61f5ac0b454e4d4a.zip
generators/hugo/_markup/render-image: Handle remote links
-rw-r--r--generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html35
1 files changed, 29 insertions, 6 deletions
diff --git a/generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html b/generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html
index 9c368c7..70f0f2f 100644
--- a/generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html
+++ b/generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html
@@ -1,14 +1,37 @@
-{{ $imageFile := print "public" (.Destination | safeURL) }}
-{{ $image := imageConfig $imageFile }}
+{{ $localPath := print "public/" ($.Destination | safeURL) }}
+{{ $remoteImage := resources.GetRemote ($.Destination | safeURL) }}
+
{{- /* This comment removes trailing newlines. */ -}}
<figure>
- <a href="{{ .Destination | safeURL }}" onclick="return false;">
+ <a href="{{ $.Destination | safeURL }}" onclick="return false;">
<img data-image-zoom
- src="{{ .Destination | safeURL }}"
+ src="{{ $.Destination | safeURL }}"
alt="{{ $.Text }}"
title="{{ $.Text | htmlUnescape | safeHTML }}"
- width="{{ $image.Width }}"
- height="{{ $image.Height }}"
+ width="
+ {{- with $remoteImage -}}
+ {{- with .Err -}}
+ {{ $localImage := imageConfig $localPath }}
+ {{- with $localImage -}}
+ {{ .Width }}
+ {{- end -}}
+ {{- else -}}
+ {{- .Width -}}
+ {{- end -}}
+ {{- end -}}
+ "
+ height="
+ {{- with $remoteImage -}}
+ {{- with .Err -}}
+ {{ $localImage := imageConfig $localPath }}
+ {{- with $localImage -}}
+ {{ .Height }}
+ {{- end -}}
+ {{- else -}}
+ {{ .Height }}
+ {{- end -}}
+ {{- end -}}
+ "
/>
</a>
<figcaption class="has-text-grey-dark">