diff options
Diffstat (limited to 'templates/shortcodes/imgswap.html')
| -rw-r--r-- | templates/shortcodes/imgswap.html | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/templates/shortcodes/imgswap.html b/templates/shortcodes/imgswap.html index f8c983c..4397b29 100644 --- a/templates/shortcodes/imgswap.html +++ b/templates/shortcodes/imgswap.html @@ -25,8 +25,11 @@ {%- endif %} {%- set img = main_src | split(pat="/") | last %} - {%- set name = img | split(pat=".") | first %} - <img src="{{ path | safe }}{{ img | safe }}" class="img-main{% if class %} {{class}}{% endif %}"{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} /> + + {%- if not alt %} + {%- set alt = img | split(pat=".") | first %} + {%- endif %} + <img src="{{ path | safe }}{{ img | safe }}" class="img-main{% if class %} {{class}}{% endif %}"{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} loading="lazy" /> {%- set dirtest = swap_src | trim_start_matches(pat="./") %} {%- if dirtest is containing("/") %} @@ -54,6 +57,9 @@ {%- endif %} {%- set img = swap_src | split(pat="/") | last %} - {%- set name = img | split(pat=".") | first %} - <img src="{{ path | safe }}{{ img | safe }}" class="img-swap{% if class %} {{class}}{% endif %}"{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} /> + + {%- if not alt %} + {%- set alt = img | split(pat=".") | first %} + {%- endif %} + <img src="{{ path | safe }}{{ img | safe }}" class="img-swap{% if class %} {{class}}{% endif %}"{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} loading="lazy" /> </div> |
