commit 67f6179e66052ce9d666185614fc99545063c563
parent 467450a1a29e3086ca3eafb557b20a5eb621b387
Author: FIGBERT <figbert@figbert.com>
Date: Wed, 9 Sep 2020 17:28:01 -0700
:art: Add types to shortcodes
Diffstat:
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/templates/shortcodes/audio.html b/templates/shortcodes/audio.html
@@ -1,6 +1,7 @@
<audio controls>
{% for source in sources %}
- <source src="{{ source }}">
+ {% set type = source | split(pat=".") | last %}
+ <source src="{{ source }}" type="{{ 'audio/' ~ type }}">
{% endfor %}
Your browser doesn't support the audio tag and/or the audio formats in use here – sorry!
</audio>
diff --git a/templates/shortcodes/gif.html b/templates/shortcodes/gif.html
@@ -1,6 +1,7 @@
<video autoplay loop muted playsinline>
{% for source in sources %}
- <source src="{{ source }}">
+ {% set type = source | split(pat=".") | last %}
+ <source src="{{ source }}" type="{{ 'video/' ~ type }}">
{% endfor %}
Your browser doesn't support the video tag, which I use in place of .gifs, and/or the video formats in use here – sorry!
</video>
diff --git a/templates/shortcodes/image.html b/templates/shortcodes/image.html
@@ -1,6 +1,7 @@
<picture>
{% for source in sources %}
- <source srcset="{{ source }}">
+ {% set type = source | split(pat=".") | last %}
+ <source srcset="{{ source }}" type="{{ 'img/' ~ type }}">
{% endfor %}
<img src="{{ fallback_path }}" alt="{{ fallback_alt }}"/>
</picture>
diff --git a/templates/shortcodes/video.html b/templates/shortcodes/video.html
@@ -1,6 +1,7 @@
<video controls>
{% for source in sources %}
- <source src="{{ source }}">
+ {% set type = source | split(pat=".") | last %}
+ <source src="{{ source }}" type="{{ 'video/' ~ type }}">
{% endfor %}
Your browser doesn't support the video tag and/or the video formats in use here – sorry!
</video>