aboutsummaryrefslogtreecommitdiff
path: root/generators
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2021-03-30 21:04:00 -0400
committerThedro Neely <thedroneely@gmail.com>2021-03-30 21:04:00 -0400
commit888eba403976f85048ae7f8c4a17b8801e62b3bc (patch)
tree1cb30c37fca42c404eba69f975ae5bebbc650cdc /generators
parent0d074086c6a900b8284a98124461c5932247dae7 (diff)
downloadthedroneely.com-888eba403976f85048ae7f8c4a17b8801e62b3bc.tar.gz
thedroneely.com-888eba403976f85048ae7f8c4a17b8801e62b3bc.tar.bz2
thedroneely.com-888eba403976f85048ae7f8c4a17b8801e62b3bc.zip
generators/hugo/layouts/_default/summary: Check if image exists
Diffstat (limited to 'generators')
-rw-r--r--generators/hugo/themes/tdro/layouts/_default/summary.html5
1 files changed, 4 insertions, 1 deletions
diff --git a/generators/hugo/themes/tdro/layouts/_default/summary.html b/generators/hugo/themes/tdro/layouts/_default/summary.html
index 2d3d546..1ddf832 100644
--- a/generators/hugo/themes/tdro/layouts/_default/summary.html
+++ b/generators/hugo/themes/tdro/layouts/_default/summary.html
@@ -1,8 +1,10 @@
<div class="columns is-mobile">
<div class="column is-5 has-text-centered">
+ {{ $imageFile := print "public/images/thumbnails/" (partial "article-image.html" .) ".png" }}
+ {{ if fileExists $imageFile }}
+ {{ $image := imageConfig $imageFile }}
<a href="{{ .Permalink }}">
- {{ $image := imageConfig (print "public/images/thumbnails/" (partial "article-image.html" .) ".png") }}
<picture>
<source srcset="/images/thumbnails/{{ partial "article-image.html" . }}.png" type="image/png">
<source srcset="/images/thumbnails/{{ partial "article-image.html" . }}.jpg" type="image/jpeg">
@@ -11,6 +13,7 @@
height="{{ $image.Height }}" width="{{ $image.Width }}"/>
</picture>
</a>
+ {{ end }}
</div>
<div class="column is-7">