summaryrefslogtreecommitdiff
path: root/source/_includes/image.html
diff options
context:
space:
mode:
authorPrefetch2023-01-01 16:40:56 +0100
committerPrefetch2023-01-01 17:02:29 +0100
commitb1a9b1b9b2f04efd6dc39bd2a02c544d34d1259c (patch)
tree1fd87919deee17e58f8ad19c09abd54bd4a70886 /source/_includes/image.html
parent1d700ab734aa9b6711eb31796beb25cb7659d8e0 (diff)
Change license, add Makefile, add image caching control
Diffstat (limited to 'source/_includes/image.html')
-rw-r--r--source/_includes/image.html14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/_includes/image.html b/source/_includes/image.html
index 5b4f35f..df13976 100644
--- a/source/_includes/image.html
+++ b/source/_includes/image.html
@@ -2,6 +2,8 @@
{% assign name = name_dot_format | first %}
{% assign format = name_dot_format | last %}
+{% assign version = include.version | default: "1" %}
+
{% comment %} Let 'suffix' = last 4 chars of 'name', 'prefix' = the rest {% endcomment %}
{% assign suffix = name | slice: -4, 4 %}
{% assign rname = name | split: "" | reverse | join: "" %}
@@ -27,14 +29,16 @@
{% assign add_style = 'style="' | append: set_style | append: '"' %}
{% endif %}
<p>
-<a href="{{ name_full }}.{{ format }}">
+<a href="{{ name_full }}.{{ format }}?v={{ version }}">
<picture>
- <source srcset="{{ name_half }}.avif" type="image/avif">
+ <source srcset="{{ name_half }}.avif?v={{ version }}" type="image/avif">
{% if name_full == name_half %}
- <img src="{{ name_half }}.{{ format }}" {{ add_class }} {{ add_style }} alt="{{ include.alt }}" title="{{ include.alt }}">
+ <img src="{{ name_half }}.{{ format }}?v={{ version }}" {{ add_class }} {{ add_style }}
+ alt="{{ include.alt }}" title="{{ include.alt }}">
{% else %}
- <source srcset="{{ name_half }}.webp" type="image/webp">
- <img src="{{ name_half }}.jpg" {{ add_class }} {{ add_style }} alt="{{ include.alt }}" title="{{ include.alt }}">
+ <source srcset="{{ name_half }}.webp?v={{ version }}" type="image/webp">
+ <img src="{{ name_half }}.jpg?v={{ version }}" {{ add_class }} {{ add_style }}
+ alt="{{ include.alt }}" title="{{ include.alt }}">
{% endif %}
</picture>
</a>