From de28182fde8607837d3f4e4aa1a0bbf58eab2fa7 Mon Sep 17 00:00:00 2001 From: Justin Cooper Date: Wed, 5 Jun 2019 12:57:15 -0500 Subject: [PATCH] fallback to original image if smaller images do not exist --- _includes/downloads/board_image.html | 15 +++++++++++++++ _layouts/download.html | 12 +++++++++++- blinka.html | 2 +- downloads.html | 12 ++---------- 4 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 _includes/downloads/board_image.html diff --git a/_includes/downloads/board_image.html b/_includes/downloads/board_image.html new file mode 100644 index 00000000..67354147 --- /dev/null +++ b/_includes/downloads/board_image.html @@ -0,0 +1,15 @@ +{% for static_file in site.static_files %} + {% assign small_image = "/assets/images/boards/small/" | append: include.board_image %} + {% if static_file.path == small_image %} + {% assign has_responsive_images = true %} + {% endif %} +{% endfor %} +{% if has_responsive_images %} + Image of Board +{% else %} + Image of Board +{% endif %} diff --git a/_layouts/download.html b/_layouts/download.html index 91099843..396266d5 100644 --- a/_layouts/download.html +++ b/_layouts/download.html @@ -8,7 +8,17 @@ layout: default
- Image of Board + {% for static_file in site.static_files %} + {% assign large_image = "/assets/images/boards/large/" | append: page.board_image %} + {% if static_file.path == large_image %} + {% assign has_responsive_images = true %} + {% endif %} + {% endfor %} + {% if has_responsive_images %} + Image of Board + {% else %} + Image of Board + {% endif %}

{{ content }}

diff --git a/blinka.html b/blinka.html index c75d4775..2f01d233 100644 --- a/blinka.html +++ b/blinka.html @@ -61,7 +61,7 @@ permalink: /blinka {{ "/assets/images/boards/large/" | append: board.board_image | relative_url }} 700w" sizes="(max-width: 1024px) 700px, 300px" - src="{{ "/assets/images/boards/original" | append: info.board_image | relative_url }}" alt="Image of Board"> + src="{{ "/assets/images/boards/original/" | append: info.board_image | relative_url }}" alt="Image of Board">

{{ board.name }}

diff --git a/downloads.html b/downloads.html index 055bab7f..187c2b75 100644 --- a/downloads.html +++ b/downloads.html @@ -72,11 +72,7 @@ permalink: /downloads
- Image of Board + {% include downloads/board_image.html board_image=info.board_image %}